moving prestashop from normal Apache site to virtual host caused prestashop to stop working - apache

I had a prestashop(1.7) site located to /var/www/html (centos 8, apache web server).
I created as per most commmon instructions two virtual hosts pointed to /var/www/sites
/var/www/sites/site1/html
and
/var/www/sites/site2/html
when i place an index.html file i can see both files (rather the hello world text).
but when i copy the whole prestashop to the /var/www/sites/site1/html it does not work. i get the 500 error.
the path in the ps_shop_url is / and the domain and domain_ssl is as it was before site1.(the virtual hosts work since I can see the index pages remember?)
what else shall i configure in prestashop files in order to be able to see the shop?
thanks and regards,
Alex

Make sure to clear the whole /var/cache directory after migrating the files,
if this doesn't help try enabling Prestashop dev_mode (https://devdocs.prestashop.com/1.7/basics/installation/configuration/)
or investigate your webserver error_log to see what's behind the error 500

Related

WAMP virtual host displays in Chrome, but Internet Explorer says "Page can't be displayed"

I installed WAMP and followed this guide to set up virtual hosts. In both Google Chrome and Internet Explorer, http://localhost gets me to "WAMPSERVER homepage" with my virtual host listed under "Your Projects."
Clicking that link to http://mysite.local in Chome brings me to my site as expected.
Clicking that link in Internet Explorer displays the following message instead.
This page can’t be displayed
•Make sure the web address http://mysite.local is correct.
•Look for the page with your search engine.
•Refresh the page in a few minutes.
Since I can see the WAMPSERVER homepage as expected in both browsers, I don't think there's a problem with my WAMP installation. Since my virtual host is working in Chrome, I think it must be configured properly in Apache and in my Windows hosts file.
I just don't understand why Internet Explorer isn't working with my virtual host like I expect it to, and the "Page can't be displayed" message doesn't give me anything helpful to work with.
Does anyone have any suggestions for me? I'd greatly appreciate any pointers or links to other guides I can try. Thanks in advance for any replies!
There's several reasons WAMP/MAMP may not work on a local environment, I'll try to list a few reasons here:
Which httpd.conf?
There are sometimes multiple httpd.conf files that can cause things to go a little bit funny. MAMP/WAMP usually tend to keep all their configuration files within a conf/ directory however, that doesn't mean to say some other httpd.conf file is being used...
You can also run this command on Linux based systems to see which one is being used:
apache2ctl -V | grep SERVER_CONFIG_FILE
vhosts definitions not included in httpd.conf
In the httpd.conf file, there's a line to include the vhosts definitions file, it should be uncommented:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf // remove the #
Incorrect vhosts definitions
Vhosts need to be defined as follows:
<VirtualHost *>
DocumentRoot "C:/path/to/your/local/site"
ServerName mydomain.local
</VirtualHost>
Hosts file
On OS X/Linux systems this can be found at etc/hosts. Edit that to reflect below (note, you'll need to be root)
127.0.0.1 mysite.local
On windows systems, it can be found in %SystemRoot%\System32\drivers\etc\hosts.
Browser caches
Browser caches always cause an issue with local servers/development. It's worth working with incognito mode on, or deleting all browser caches each and every time you open it up. There's a few plugins available for most browsers that should help too.
Other points to note
Whenever you edit anything to do with httpd.conf, vhosts, hosts file - WAMP/MAMP/Apache needs to be restarted. It's a good idea to shut the server down before doing the changes.
You mentioned that there was a hardcoded link in one/some of your files. It's generally regarded as bad practise to do that for this exact reason. Your code is less portable and can 'break' on other systems. I'd suggest using PHP's __FILE__ or similar to achieve what you want.
Alternatively you could set up local configuration files for your app that are only included when they're present. Have a look at this for a good example of such a set up.
Log everything. Check the logs regularly too.

WAMP localhost and phpmyadmin setup

I have inherited a WAMP setup, but needed my http://localhost to point to a different directory "C:/Users/[user.name]/htdocs" due to many dependencies.
I made the following changes in httpd.conf
DocumentRoot "C:/Users/[user.name]/htdocs"
<Directory "C:/Users/[user.name]/htdocs">
where the original path was "c:/wamp/www/"
Now the WAMP default path for phpMyAdmin http://localhost/phpMyAdmin is not working anymore.
Is it possible to fix that via either C:\wamp\alias\phpmyadmin.conf or httpd-vhosts.conf somehow?
Can I suggest a better solution to your requirement to have a site running that does not live in the WAMPServer default location i.e. \wamp\www or \wamp\www\somefolder
If you revert all your httpd.conf changes to the out of the box state and then create a Virtual Host to run the site you have located in your \user.... folder.
Virtual Hosts are a standard Apache feature that allows you to run may sites from a single instance of Apache, a bit like a shared hosting package setup.
You would then have the benefits of the WAMPServer homepage running on localhost and all the other alias's tools as well.
You can then run your site using a nice url for example sitename.dev and the virtual host definition also allows you to setup any site specific requirements without effecting any other site you may want to run.
There is a HowTo Setup Virtual Hosts here on SO

Https and http not working together on MAMP Pro

I created a host on Mamp pro using their GUI app which is called "site1". If I go to https://site1/, it is working fine. If I go to http://site1, then it loads the root of http://localhost.
Based on GUI,
http//localhost's document root is applications/mamp/htodocs/
http//localhost's document root is applications/mamp/htodocs/site1/
If I disable https, then the http site works correctly. I need the both protocol for the site. How could I fix that? Any help? I am also unable to recognize the correct httpd.conf files which are associated with these hostnames.
On the GUI management window, I just added the following code into the additional virtual host parameters and both http and https started working fine together.
ServerName site1
DocumentRoot "/Applications/MAMP/htdocs/site1"
It would still be good to know where and how MAMP is creating the conf files.

where should i define my virtual hosts? conf/httpd.conf or conf.d/user.conf

i have seen more than one tutorial that i have been using trying to get suPHP running on my centos 6.5 box.
first off, standard lamp virtual hosts tutorials always add virtual hosts into /etc/httpd/conf/httpd.conf however, a different tutorial that i was looking at (http://invision-web.net/web/install-configure-apache-php-suphp-virtual-hosts-centos/) puts the virtual hosts into /etc/httpd/conf.d/user.conf
is there a right or wrong way to do this? is one better than another?
also, i understand that httpd.conf is the main apache config file, but what exactly is the user.conf file?
The virtual host configurations should normally go in main Apache configuration file httpd.conf. In the article link you posted above the configuration
creates a virtual host for user invision on domains
n1.invision-web.net and www.invision-web.net
. Unless you have multiple site users which require configuration at a per-user level, this is not necessary. The article does not make this clear at all.
user.conf is for per-user configuration. For example, where sites have multiple users (e.g. access to http://www.mysite.com/~pedro (delivering content from the home directory or sub-directory of user pedro) can be configured in the users.conf file. More details in Apache docs.

Hosting not loading pages

i am new to web hosting, but i purchased a domain from namecheap.com and i purchased web hosting from ramnode.com to host my domain, i am using centOS 32bit as my server, and i have pointed my domain to ramnode nameservers that were provided to me.
The problem i am having here is that everytime i load my website, it just says
Index Of/
cgi-bin/
even though i have placed my web page files in var/www, and var/www/html like ramnode support told me too, it still does not want to work. Any suggestions?
It all depends on how your server is setup but here are a few things to check.
What are the permission levels for your files, who owns them and what group are they in? If you don't have proper permissions set they may not show. If the wrong person owns them they may not show.
Read over your httpd.conf (centos should have it in /etc/httpd/conf) see how your server is setup. It may not have a default setup, perhaps your using a virtual host?
In a nutshell we need more information to help you out.
You should have an
.htaccess or htaccess.txt file in your WWW root, whithin that file you need the following line:
DirectoryIndex index.htm index.html index.php
That is the priority order of your index page. (Your web project needs an index page)
So in otherwords your webserver will serve the first matching file that it finds in that list.
A quick fix if you cant find the htaccess file, is just make sure you have an index.html file in your var/www
I just reset my nameservers to point to ramnode's last night and am experiencing the same issue as the OP this morning.
I previously had no FQDN for the ramnode server and simply used my /etc/hosts file locally to point to the ramnode server. Through that method, I was able to make sure everything was setup just so - apache virtualhosts, .htaccess files, apache.conf, and httpd.conf files all operating as desired.
It seems to have something to do with the installation of the cpanel, which auto-fills DNS A records with a different IP than the one I was provided. changing it to ramnode's original IP simply leads to the same cgi-bin directory index. But going going to the original ip in the browser leads to my site, as I have the apache virtualhost set for the IP.
Ramnode sets subdomain a records such as cpanel.mydomain.com all set to the same new IP and those do function, so it leads me to believe a ramnode server is capturing the trafic elsewhere and should be sending it on but isn't.
It's a bit confusing where cpanel is taking me and why redirecting to my the domain.com. A record to the original IP seems to have no effect.