Rumah >pembangunan bahagian belakang >tutorial php >Nginx + php 配置 用IP的模式能访问 域名的方式却不可以
Nginx + php 配置 用IP的方式能访问 域名的方式却不可以
这是我的nginx.conf文件
#user nobody;<br />worker_processes 1;<br /><br />#error_log logs/error.log;<br />#error_log logs/error.log notice;<br />#error_log logs/error.log info;<br /><br />#pid logs/nginx.pid;<br /><br /><br />events {<br /> worker_connections 1024;<br />}<br /><br /><br />http {<br /> include mime.types;<br /> default_type application/octet-stream;<br /><br /> #log_format main '$remote_addr - $remote_user [$time_local] "$request" '<br /> # '$status $body_bytes_sent "$http_referer" '<br /> # '"$http_user_agent" "$http_x_forwarded_for"';<br /><br /> #access_log logs/access.log main;<br /><br /> sendfile on;<br /> #tcp_nopush on;<br /><br /> #keepalive_timeout 0;<br /> keepalive_timeout 65;<br /><br /> #gzip on;<br /><br /> server {<br /> listen 81;<br /> server_name www.test.com;<br /> root D:/src/web/runroot;<br /> error_page 404 /404.html;<br /> error_page 500 502 503 504 /50x.html; if ($remote_addr !~ "123.125.169.174") {<br /> # rewrite ^ http://lavaradio.wix.com/lavaradio redirect;<br /> }<br /> rewrite ^/api/(.*?)\.json$ /index.php?route=api/$1&_of=json break;<br /> if (!-f $request_filename) {<br /> rewrite ^/(.*?)$ /index.php?route=$1 last;<br /> } <br /> location /index.php {<br /> fastcgi_pass 127.0.0.1:9000;<br /> fastcgi_index index.php;<br /> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br /> include fastcgi_params;<br /> }<br /> } <br />}