2021年3月24日星期三

How do we do nginx-proxy in centos when having a wp site build with docker?

in ubuntu, but I am switching to centOS now I have a file call www.testing.com.conf in /etc/nginx/site-enabled soft linked from /etc/nginx/site-available.

The file has content as:

server {          root /var/www/html;          listen 80;          listen [::]:80;          server_name testing.com www.testing.com;          location / {                  proxy_pass         http://127.0.0.1:8080;                  proxy_redirect     off;                  proxy_set_header   Host $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-Host $server_name;                  proxy_set_header   X-Forwarded-Proto $scheme;          }  }  

Basically, my understanding of this file is to act as proxy for the docker wordpress site listening on port 80 for any incoming traffic to "proxy" to localhost:8080 which is the wordpress container working.

How can we achieve the same goal in centoOS ? Nginx server is up and running now since url respondes as

This is the default index.html page that is distributed with nginx on Red Hat Enterprise Linux. It is located in /usr/share/nginx/html.    You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.    For information on Red Hat Enterprise Linux, please visit the Red Hat, Inc. website. The documentation for Red Hat Enterprise Linux is available on the Red Hat, Inc. website.   

What I have try, but it does not work:

updated the /etc/nginx/nginx.conf file as below to make the www.testing.com.conf file inside the /etc/nginx/site-enabled

 38     server {   39         listen       80 default_server;   40         listen       [::]:80 default_server;   41         server_name  _;   42         root         /usr/share/nginx/html;   43         #root         /home/x/wordpress-docker-compose/wp-app/;   44    45         # Load configuration files for the default server block.   46         include /etc/nginx/sites-enabled/www.testing.com.conf;   47         #include /etc/nginx/default.d/*.conf;   48   

Or we don't do it the same way in centos when we use nginx proxy ? Any help is appreciated

https://stackoverflow.com/questions/66792868/how-do-we-do-nginx-proxy-in-centos-when-having-a-wp-site-build-with-docker March 25, 2021 at 11:56AM

没有评论:

发表评论