Centos7.3 builds LNMP and deploys wordpress site
Centos7.3 builds LNMP and deploys wordpress site
I. Topology diagram
2. Preparatory work:
1. Three independent hosts (virtual machines)
Nginx:10.0.0.11
Php-fpm:10.0.0.2
Mariadb:10.0.0.13
Prepare yum environment (recommend Aliyun yum source, please search it by Baidu)
two。 Related software package preparation
10.0.0.11 (nginx)
Yum install nginx-y
10.0.0.2 (php-fpm)
Yum install php-fpm php-mysql php-mbstring php-mcrypt php-xcache-y
10.0.0.13 (mariadb)
Yum install mariadb-server-y
Third, construction steps
1.nginx host operation
1. Installation
Yum install nginx-y
two。 Configure nginx to support reverse proxy php-fpm
Vi / etc/nginx/conf.d/huwho.conf server {listen 80; server_name www.huwho.com; # web site domain name index index.php index.html index.htm; # defines a web site for nginx and places the web static resource location / {root / web/www; index index.html index.htm index.php } # define a web status page location / status {stub_status;} # pass the PHP scripts to FastCGI server listening on 10.0.0.2 stub_status; 9000 # reverse proxy php, place the web dynamic resource location ~ *\ .php$ {root / web/www/php # php's site root directory fastcgi_pass 10.0.0.2 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME 9000; # fastcgi's address fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / fastcgi}}
3. Create the appropriate directory
Mkdir / web/www/-pv echo nginx web test > > / web/www/
4. Start the nginx service and test
Systemctl start nginx
2.php-fpm host operation
1. Installation
Yum install php-fpm php-mysql php-mbstring php-mcrypt php-xcache-y
2.php-fpm profile modification
Modify three locations in the diagram
Vi / etc/php-fpm.d/www.conf
3. Start the php-fpm service
Systemctl start php-fpm [root@localhost ~] # ss-tlnState Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *: 111 *: * LISTEN 0 5 192.168.122.1 virtual 53 *: * LISTEN 0128 *: 22 *: * LISTEN 0128 127.0.0. 1RV 631 *: * LISTEN 0 100 127.0.0.1 LISTEN 25 *: * LISTEN 0 128 10.0.0.2 9000 *: * LISTEN 0 128 : 111l:: * LISTEN 0128: 22 : * LISTEN 0 128:: 1 631:: * LISTEN 0 100 1:25:: *
4. Create a dynamic resource directory and an index.php file for testing
Mkdir / web/www/php-pvcd / web/www/phpvi index.phpwelcome to www.huwho.com website.