Ubuntu Nginx+Apache动静分离

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

猜你喜欢

转载自blog.csdn.net/zwliang98/article/details/83005766