I'm setting up a server on Rackspace for migrating an existing website to so I can have everything working before changing the DNS entry.
I had no problems getting the server to work at the IP address using the default setup. I then copied the original sites-available file, symlinked to it in sites-enabled, and copied the original index.html
to a new folder. I set the sites-available root to the new folder and did chown -R www-data:www-data
, chmod 775
on the folder, and chmod 664
on the file. After which I restarted Nginx.
When I bring up the IP address of the site, I get 404 Not Found.
Here is sites-available:
server {
listen [::]:80 default_server;
root /var/www/example.com/public/;
index index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
}
Ever the humbling experience, Linux is. Someone on the nginx mailing list kindly pointed out that I should check permissions of
/var/www/
, and low and behold, I had accidentally entered the wrong code when I didchmod
on/var/www/
. Everything works properly now. On with the migration...The problem I see straight away is that you have a tailing slash on the root option.
Change
/var/www/example.com/public/
Change to:
/var/www/example.com/public
Additionally if you don't have any luck with the above try the below code, this gets rid of the localhost element and hard sets the domain that you want to use.