The Nginx + php configuration can access the domain name using an IP address, but it cannot be my nginx. conf file.
#user nobody;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 81; server_name www.test.com; root D:/src/web/runroot; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; if ($remote_addr !~ "123.125.169.174") { # rewrite ^ http://lavaradio.wix.com/lavaradio redirect; } rewrite ^/api/(.*?)\.json$ /index.php?route=api/$1&_of=json break; if (!-f $request_filename) { rewrite ^/(.*?)$ /index.php?route=$1 last; } location /index.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } }
I have added it to C: \ Windows \ System32 \ drivers \ etc \ hosts
127.0.0.1 www.test.com
With 127.0.0.1: 81, you can access www.test.com and the website cannot be displayed"
Reply to discussion (solution)
You have to add a port number!
Www.test.com: 81
If you do not want the port number, change 81 to 80.
The default port is port 80. if you change it to port 81, port 80 will be added.
Www.test.com is not your real domain name. you have to add it to the local hosts file.
192.168.1.100 www.test.com
192.168.1.100 is the ip address of your nginx server
Use phpfind directly. there is no need to waste time on configuration.