Nginx + PHP Configuration IP can access the domain name of the way but can not
This is 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 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'm already in C:\Windows\System32\drivers\etc\hosts.
127.0.0.1 www.test.com
With 127.0.0.1:81 can be accessed using www.test.com directly is "Unable to display this page"
------to solve the idea----------------------
Big Brother, you have to add a port number, okay!
www.test.com:81
If you don't serve something the slogan, change 81 to 80.
------to solve the idea----------------------
The default is 80 port, you change to 81 will add port OH
And www.test.com is not your real domain name, you have to add in the local Hosts file
192.168.1.100www.test.com
192.168.1.100 is the IP of your nginx server.
------to solve the idea----------------------
Use Phpfind directly, there is no need to waste time on the configuration