I have a wordpress site, which was built using the lnmp environment. In the past, wordpress was deployed in the root directory and could be accessed directly using the domain name www.xxxxx.com. First, I want to move this wordpress to a subdirectory, for example, to the mse_cn folder in the root directory, and then access it through www.xxxxx.com/mse_cn. First, I moved the code to the mse_cn folder, and then modified nginx Configuration:
server {
listen 80;
server_name www.xxxx.com;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location ^~ /mse_cn {
root /usr/share/nginx/html;
index index.php index.html index.htm;
try_files $uri $uri/ /mse_cn/index.php;
location ~ \.php {
fastcgi_split_path_info ^(.*\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Reload the nginx configuration file, and then I visit www.xxxxx.com/mse_cn and a 404 error is reported, and the page displays very strangely. Please help me! ! !
location ^~ /mse_cn {
What the hell? Shouldn't lnmp be in the /home/wwwroot directory by default?
www.xxxxx.com/mse_cn To access in this way, you only need to move the wp to the mse_cn directory of the previous xxxxx.com. There is no need to make any modifications to the original vhost.conf of nginx