Lnmp of WordPress pseudo-static rule configuration

Source: Internet
Author: User
Tags vps


Replaced the VPS, it is necessary to start to move to the site, moving the first problem is the pseudo static WordPress problem. The new VPS uses a LNMP environment and installs the AMH panel. Previously used is the lamp environment Webmin, but the Webmin function is too bloated complex, more memory consumption, and nginx compared to more efficient and stable Apache. So this decision adopts LNMP environment. Although this is more frustrating, but only to toss it will have an unexpected harvest.

NIGNX does not support. htaccess pseudo static rules that need to be modified NIGNX the corresponding configuration file to add pseudo static rules, the following records the entire modification configuration process:

1, log on to the Linux server,

2, open/usr/local/nginx/conf/vhost/"your domain name". Conf,linux commands such as:

Vi/usr/local/nginx/conf/vhost/sufaming.com.conf

3, find

{
Root/Your site path
}

Enter I (insert text command)

Add under it:

Location/{
Index index.html index.php;
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;
}
}

4, and finally press ESC to jump to the command mode, enter: Wq, save the file and Exit VI.

Save after modification ... After the save has not been effective, need SSH link to give

Service Nginx Reload

The order will not take effect.


Universal WordPress Pseudo-static configuration rules

Rewrite ^.*/files/(. *) $/wp-includes/ms-files.php?file=$1 last;

if (!-e $request _filename) {

Rewrite ^.+? (/wp-.*) $ last;

Rewrite ^.+? (/.*\.php) $ $ last;

rewrite ^/index.php last;

}

Another pseudo-static rule for WordPress fixed links under Nginx

It is OK to add a row to the location section of the Nginx configuration file nginx.conf.

1. Open Nginx configuration file:

# vim/etc/nginx/nginx.conf (this path is different from the installation path depending on the Linux version)

2. Add the following lines to the server container

Location/
{
Try_files $uri $uri//index.php?q= $uri & $args;
}

3. reload Nginx configuration file

#/etc/init.d/nginx Reload

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.