How to install Nginx Proxy Server

  Others-其他
  • Install Apache and Nginx

root@XSHQSDO03:~# apt-get install apache2 nginx

  • Change the default port for Apache server

root@XSHQSDO03:~# vim /etc/apache2/sites-available/000-default.conf

root@XSHQSDO03:~# vim /etc/apache2/ports.conf

  • Config the proxy server for Apache

        root@XSHQSDO03:~# vim /etc/nginx/conf.d/default.conf

server {

listen 80 default_server;

index index.php index.html index.htm;

location / {

proxy_pass http://localhost:8080;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

  • Restart all the services and testing proxy is OK.

root@XSHQSDO03:~/wordpressbak# systemctl restart apache2

root@XSHQSDO03:~/wordpressbak# systemctl restart nginx

LEAVE A COMMENT