Focus on cloud service provider activities
Notes on website operation and maintenance

Pseudo static Solution of WordPress Program in LNMP Environment

The LNMP environment is currently used by our domestic webmasters in the Linux VPS configuration environment. As a novice, we are likely to see something similar to Lao Zuo“ LNMP Installation Tutorial "Then follow the example to install VPS. Have we found that the wordpress pseudo static, which we often use in the environment, does not work, and 404 error pages appear on the inner page? This problem is easy to solve. Because our lnmp uses nginx instead of Apache, it is better for Apache to directly drop the htaccess file to the root directory of the website to make the pseudo static work.

First of all, the pseudo static file wordpress.conf already exists in the default installed lnmp environment in "/usr/local/nginx/conf/wordpress.conf". We can check whether the compiled code is:

if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!- f $request_filename){
rewrite (.*) /index.php;
}

If not, we need to modify the above code file to rewrite the pseudo static.

Secondly, we need to set the configuration file of our website:

/Usr/local/nginx/conf/vhost/www.laozuo.org.conf (add your own domain name and name it automatically)

We will see code similar to the following green Some of them are added by me, so you can add them:

server {
listen 80;
server_name www.laozuo.org;
index index.html index.php;
include wordpress.conf;

Finally, we use ssh to log in to VPS, and then restart lnmp with the following command

/root/lnmp restart

After executing the above three steps, have we solved the pseudo static problem? Other common CMSs are the same. The default conf basically contains the CMS pseudo static compilation script we need. Finally, by the way, some friends need to use 301 jump, such as only using the WWW domain name as the main domain name. Please refer to“ LNMP Series Tutorial 5: How to Set 301 Redirection "One article solution. Lao Zuo will not repeat.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Pseudo static Solution of WordPress Program in LNMP Environment


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge