nginx做代理部署WordPress


實驗環境:CentOS7

服務器172.16.252.142做Nginx代理服務器:

[root@conf.d localhost]#iptables -F
[root@conf.d localhost]#setenforce 0
[root@conf.d localhost]#yum -y install nginx
[root@conf.d localhost]#cd /etc/nginx/conf.d/
[root@conf.d localhost]#vim default.conf
#靜態資源和動態資源全部用一台服務器172.16.254.47,用不同的端口;
server {
        listen 80;
        server_name www.mylinux.io;

        location ~* \.(html|js|css|jpg|jpeg|png|gif)$ {
        #location  /  {
                proxy_pass http://172.16.254.47:80;
        }
        location ~* \.php$ {
                fastcgi_pass 172.16.254.47:9000;
                fastcgi_index index.php;
                include fastcgi_params;
#向后端php-fpm服務器傳遞腳本的方式:是在fastcgi_param文件中,將變量SCRIPT_NAME向后傳遞,/data/apps是php-fpm的document路徑
                fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress$fastcgi_script_name;
}
}
[root@conf.d localhost]#nginx -t
[root@conf.d localhost]#nginx -s reload

RS:172.16.254.47

[root@html localhost]#yum -y install mariadb-server php-mysql
[root@html localhost]#chown -R nginx:nginx wordpress/
[root@html localhost]#vim /etc/php-fpm.d/www.conf 
listen = 172.16.254.47:9000   #監聽本地地址
listen.allowed_clients = 172.16.252.142  #Nginx代理服務器的地址
[root@html localhost]#mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 286
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> GRANT ALL ON wp.*  TO wp@'172.16.254.47' IDENTIFIED BY '123456';
MariaDB [(none)]> CREATE DATABASE wp;
MariaDB [(none)]> FLUSH PRIVILEGES;

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM