gpt4 book ai didi

nginx centos 7服务器多个网站

转载 作者:行者123 更新时间:2023-12-04 19:42:23 25 4
gpt4 key购买 nike

我的服务器 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;
}
}

最佳答案

为什么不同的文件?你应该把它放到/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;
}
}
}

关于nginx centos 7服务器多个网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51802546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com