Nginx + PHP configuration with IP mode can access the domain name of the way but can not

Source: Internet
Author: User
Tags nginx server
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.