我build立了许多域,但我不知道如何configuration,如果只有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; } }
你想保持你的networking层在这里。 server_name用于HTTP(第7层)请求中的HOST头,其中Listen是IP和端口 – networking层和传输层,或IP和TCP包(层3和层4)。