我的域名是www.example.com,nginx文件如下所示,所以我的根路径是/var/www/campaignmanager/bannerad/public。example.com and nginx file like below. So my root path is /var/www/campaignmanager/bannerad/public.
因此,我的域在浏览器中打开,如www.example.com,但我想打开它,如example. com/campaignmanager或www. example. com/campaignmanagerexample.com but i want to open it likeexample.com/campaignmanagerorwww.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;
}
}
}
1条答案
按热度按时间cbwuti441#
您可以结合使用server和location指令来完成此操作。
请原谅语法错误。https://www.keycdn.com/support/nginx-location-directive/http://nginx.org/en/docs/http/server_names.html