例如,我想使用具有不同IP地址的两个不同域
domain1.com - 12.34.56.78
domain2.com - 98.76.54.32
Run Code Online (Sandbox Code Playgroud)
我在Linux OS上使用nginx.我应该在我的nginx.conf中添加什么?
您必须使用块创建两个虚拟主机server.
让我们假设/var/www包含domain1.com和domain2.com目录包含任何HTML页面,CGI脚本,......
server {
listen 12.34.56.78:80;
server_name domain1.com
index index.html;
root /var/www/domain1.com
}
server {
listen 98.76.54.32:80;
server_name domain2.com;
index index.html;
root /var/www/domain2.com
}
Run Code Online (Sandbox Code Playgroud)