Wordpress3.9 enable multi-site configuration and configure nginx for LAN testing.

Source: Internet
Author: User

Because we need to migrate some data for staff, we thought of using WordPress for multiple sites. This feature was available after wordpress3.0.

Software System and other information: OS: Linux Debian wheezy

PHP: 5.4.4-14

MySQL: 5.5.37

Server: nginx1.2.1/Apache 2.2.2

First download wordpress3.9. During installation, note that my WWW directory is/home/WWW, And the WordPress path is/home/www/WordPress.

My nginx does not configure anything by default, so you can enter

127.0.0.1/WordPress/WP-admin/install. PHP can be installed. however, this is not the case here, because the nginx rewrite Based on localhost on multiple sites is invalid, so we need to configure the nginx virtual host first.

In Debian, The nginx configuration file is/etc/nginx. conf to manage global. in/etc/nginx/Site-available and/etc/nginx/CONF. D is used to manage Virtual Hosts

Here we create a new WP file in/etc/nginx/Site-available/WP

# Touch/etc/nginx/Site-available/WP

Add the following content. Note that here we are a practical domain name-based.

{    listen 80;    server_name wp.com www.wp.com *.wp.com;    charset utf-8;    index index.html index.htm index.php;    root /home/www/wordpress;    location / {        autoindex on;        autoindex_exact_size on;        autoindex_localtime on;        index index.php index.html;        if (!-f $request_filename) {            rewrite ^(.*)$ /index.php?_rp_=$1 last;            break;        }    }    location ~ .*\.(git|jpg|jpeg|png|bmp|swf)$ {        expires 1d;    }    location ~ .*\.(js|css)?$ {        expires 12h;    }    location ~ \.php$ {        fastcgi_pass unix:/var/run/php5-fpm.sock;        fastcgi_index index.php;        fastcgi_param SCRIPT_FILENAME /home/www/wordpress$fastcgi_script_name;        include fastcgi_params;    }    location /doc/ {        alias /usr/share/doc/;        autoindex on;        allow 127.0.0.1;        allow ::1;        deny all;    }}
Then, because it is a local test, you need to modify the hosts of the above server name.

# Vim/etc/hosts

Add the following line in hosts

127.0.0.1 *.wp.com www.wp.com wp.com

Then reload nginx

# Nginx-t pass the test and then reload

#/Etc/init. d/nginx reload

Now you can use wp.com to access the initial WordPress installation interface.








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.