Ubuntu Nginx+Apache動靜分離
阿新 • • 發佈:2018-10-31
1. 配置Nginx
- 修改
/etc/nginx/sites-available/default
location ~ \.php$ {
#include snippets/fastcgi-php.conf;
#With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
#With php7.0-fpm:
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
proxy_pass http://127.0.0.1:8080; # 新增此程式碼,指向動態伺服器的ip地址及埠號
}
2. 配置Apache
- 修改監聽的埠號
/etc/apache2/ports.conf
# Listen 80
Listen 8080
3. 重啟服務
sudo /etc/init.d/nginx reload
sudo /etc/init.d/apache2 reload
nginx埠號為80,apache埠號為8080