我的服务器ip是103.107.122.13,端口是5680。我想要两个应用程序,假设103.107.122.13:5680/test1,然后进入var/www/html/test1网站和103.107.122.13:5680/test2,它使用虚拟主机进入var/www/html/test2网站。请告诉我如何管理此需求以及nginx.conf文件中的任何更改。
如果有人知道,请帮我解决这个问题。我已经在站点可用的文件夹test1.conf文件中写入了两个文件
server {
listen 80;
location /test1{
root /var/www/html/test1;
index index.php;
try_files $uri $uri/ =404;
}
}和test2.conf文件
server {
listen 80;
location /test2{
root /var/www/html/test2;
index index.php;
try_files $uri $uri/ =404;
}
}发布于 2018-08-12 02:26:09
为什么是不同的文件?您应该将其放到/etc/nginx/nginx.conf:
http {
server {
listen 80;
location /test1{
root /var/www/html/test1;
index index.php;
try_files $uri $uri/ =404;
}
location /test2{
root /var/www/html/test2;
index index.php;
try_files $uri $uri/ =404;
}
}
}https://stackoverflow.com/questions/51802546
复制相似问题