I have several websites on my linode LEMP stack (using nginx instead of apache). Each site lives in a separate folder /srv/www/sitename.com, where sitename is the name of the respective site.
I'm trying to migrate one site from it's previous host but I dont want to change the DNS records until the site is setup. However, I can't figure out how to access the site without it's domain name. I've tried IP-address/sitename.com but that just redirects me to my default_server.
Each domain has a configuration file in /etc/nginx/sites-available that looks something like this (below). What should I add to the configuration so that I can access the site with the ip address instead the sitename?:
server {
listen 80;
server_name
www.sitename.com sitename.com;
access_log /srv/www/sitename.com/logs/access.log;
error_log /srv/www/sitename.com/logs/error.log;
root /srv/www/sitename.com/public_html;
index index.php;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/sitename.com/public_html
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Any help is appreciated! Thanks.