How to setup nginx with IP address as server name?
server {
listen 80;
server_name xx.xx.xx.xx;
location /test {
root /var/www/test;
}
location ~ \.php$ {
include /var/ini/nginx/fastcgi.conf;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/test$fastcgi_script_name;
}
}
So I want to access the server like this
http://xx.xx.xx.xx/test/ => index.php
http://xx.xx.xx.xx/test/foo.php => foo.php
You can just put the IP address as the server name:
You may also want to change the configuration to only listen on the specified IP address:
The following is from the docs: http://nginx.org/en/docs/http/server_names.html