我有主域的vhostwww.example.com. 我想在一个名为news (www.example.com/news/).
这是vhost配置文件。
server {
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/ssl/bundle_example.com.crt;
ssl_certificate_key /etc/ssl/example.com_private_key.key;
location / {
root /www/sites/Yoga-Frontend/dist/Yoga-Frontend;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /news {
root /www/sites/Yoga-Frontend/dist/Yoga-Frontend/news;
index index.php;
try_files $uri $uri/ /news/index.php?$args /news/index.php?q=$uri&$args;
access_log /var/log/nginx/blog.access.log;
error_log /var/log/nginx/blog.error.log;
location ~ \\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}
}
问题:一旦我进入
www.example.com/news/, 它总是重定向到
www.example.com.