修改nginx配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@web01 ~]# vim /etc/nginx/conf.d/linux.blog.com.conf server { listen 80; server_name linux.blog.com; root /code/wordpress; location / { index index.php; } location ~* \.php$ { fastcgi_pass 172.16.1.8:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } |
重启访问
1 2 3 |
[root@web01 ~]# systemctl restart nginx #访问页面http://linux.blog.com/,报错502 |
修改PHP监听端口
1 2 3 4 5 6 7 8 |
[root@web02 ~]# vim /etc/php-fpm.d/www.conf #修改监听地址 listen = 172.16.1.8:9000 #修改允许连接的ip地址 listen.allowed_clients = 172.16.1.7 #重启服务 [root@web02 /code]# systemctl restart php-fpm |
再次访问页面
1 |
#报错页面找不到或者文件找不到 |
同步nginx站点文件
1 |
[root@web01 /code]# scp -r wordpress 172.16.1.8:/code/ |
再次访问测试
1 |
#图片丢失 |
php服务器挂载
1 |
[root@web02 /code]# mount -t nfs 172.16.1.31:/data/wp /code/wordpress/wp-content/uploads |