【发布时间】:2017-11-22 14:58:11
【问题描述】:
我的域类似于 example.com 和 nginx 文件,如下所示。 所以我的根路径是/var/www/campaignmanager/bannerad/public。
所以我的域在 example.com 之类的浏览器中打开,但我想像 example.com/campaignmanager 或 www.example.com/campaignmanager 一样打开它
请帮帮我。
server {
listen 80;
listen [::]:80;
root /var/www/campaignmanager/bannerad/public;
index index.php index.html index.htm;
server_name exmaple.com www.example.com;
location / {
try_files $uri $uri/index.html $uri.html @upstream;
}
location @upstream {
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
【问题讨论】:
-
我认为您只需将
server_name exmaple.com www.example.com;更改为server_name exmaple.com www.example.com/campaignmanager;然后sudo systemctl reload nginx希望这对您有所帮助!告诉我。 -
这对你有帮助吗??
-
这对 Hiren 不起作用。
-
当我重新启动 nginx 时。得到类似的错误。 nginx.service 的作业失败,因为控制进程以错误代码退出。详见“systemctl status nginx.service”和“journalctl -xe”。
-
将您的位置路径更新为
/sample