我设置了很多域,但我不知道如果只给出ip地址,如何配置.
说foo.com我有设置去web / foo.com / htdocs,
我想将88.99.66.55的ip地址像web / fook.com / htdocs这样的域名
server { listen 80; server_name 85.99.66.55; location / { root /home/web/fook.com/htdocs; } location ~ \.(PHP|PHP3|PHP4|PHP5)${ root /home/web/fook.com/htdocs; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } }
导致
[warn]: conflicting server name "85.105.65.219" on 0.0.0.0:80,ignored
IP 0.0.0.0表示所有IP.所以我认为你想要的更像是:
server { listen 85.99.66.55:80; server_name *.fook.com; location / { root /home/web/fook.com/htdocs; } } server { listen 85.99.66.55:80; server_name *.arf.com; location / { root /home/web/arf.com/htdocs; } }
您希望在此处保持网络层直接. server_name用于HTTP(第7层)请求中的HOST标头,其中Listen用于IP和端口 – 网络和传输层,或IP和TCP数据包(第3层和第4层).