每个人 我在使用Nginx部署octobercms时遇到了一些问题 这是主要的网站网址:https://staging.guardianangel.network 我想将十月cms网站部署为该主站点的子域 即https://staging.guardianangel.network/advice
这是我所做的,但无法正常工作
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/staging.guardianangel.network/before/*;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name staging.guardianangel.network;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/staging.guardianangel.network/485559/server.crt;
ssl_certificate_key /etc/nginx/ssl/staging.guardianangel.network/485559/server.key;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/staging.guardianangel.network/server/*;
root /home/forge/staging.guardianangel.network/current/public;
index index.html index.htm index.php;
error_page 404 /index.php;
access_log off;
error_log /var/log/nginx/guardianangel.network-error.log error;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location / {
try_files $uri $uri/ /index.php?$query_string;
auth_basic "Restricted Area";
auth_basic_user_file /home/forge/staging.guardianangel.network/.htpasswd;
}
location /advice {
root /home/forge/advice/public;
rewrite ^/advice/(.*)$ /$1 break;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
set $newurl $request_uri;
if ($newurl ~ ^/advice(.*)$) {
set $newurl $1;
root /home/forge/advice/public;
}
#return 200 $args; add_header Content-Type text/plain;
#return 200 $uri; add_header Content-Type text/plain;
#return 200 $document_root; add_header Content-Type text/plain;
#return 200 $request_uri; add_header Content-Type text/plain;
#return 200 $newurl; add_header Content-Type text/plain;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REQUEST_URI $newurl;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.(?!well-known).* {
deny all;
}
location /resources {
alias /home/forge/blog/current/public;
try_files $uri $uri/ @resources;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
location @resources {
rewrite ^/resources/(.*) /resources/index.php?$query_string;
}
client_max_body_size 12M;
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/staging.guardianangel.network/after/*;
当我访问https://staging.guardianangel.network/advice时,所有样式都被破坏,当我想尝试使用后端(https://staging.guardianangel.network/advice/backend)时,它会将我重定向到https://staging.guardianangel.network/backend/backend/auth
我该如何解决这个问题?
答案 0 :(得分:0)