我在 nginx 上创建了子域名,我已经在 sites-available 上进行了配置并且已经将其符号链接到 sites-enabled,我还向 cloudflare 添加了记录,例如类型:Aname:Blogco...
我在 nginx 上创建了子域名,我在 sites-available 上做了配置,并且还将其符号链接到 sites-enabled,
我还向cloudflare添加了记录,例如Type: Aname: Blogcontent: IP
但是当我打开子域名时,子域名打开了主域名的根文件夹,尽管我已经在子域名配置中设置了它,如 /var/www/panel/,而子域名打开的是 /var/www/wordpress,它是主域名的根目录
这里是主域的配置
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;
root /var/www/wordpress;
index index.php index.html index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
error_log /var/log/nginx/example_error.log;
access_log /var/log/nginx/example_access.log;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/ssl/example.pem;
ssl_certificate_key /etc/ssl/example.key;
root /var/www/wordpress;
index index.php index.html index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
error_log /var/log/nginx/example_error.log;
access_log /var/log/nginx/example_access.log;
}
这里是子域名的配置
server {
listen 80;
listen [::]:80;
server_name panel.example.com www.panel.example.com;
root /var/www/panel;
index index.php index.html index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}