Nginx port available for all url -


i'm working docker , nginx , default.conf file :

server{         listen 80 default_server;         server_name localhost;          location / {                 root /usr/share/nginx/html;         } }  server{         listen 80;         server_name blog.domain.com;          location / {                 proxy_pass   http://my-ip:8080;         } } 

so quick explanation :

  • the defaut host serve html folder, no problem that.
  • the url blog.domain.com serve wordpress application running on port 8080, no problem that.

i have application running on port 8081 (phpmyadmin) , problem is, if try http://my-ip:8081 or blog.domain.com:8081 it's ok, can access phpmyadmin... why ?

i don't want port 8081 available url on server.

phpmyadmin work proxy_pass directive. can deny location whole earth. guess nginx not server listening on port 8080 80 else listening on 8080 , wish have nginx proxy server. in such case, work. minimum config :

# first server block     server {     listen 80;     server_name domain.com;         location / {         root /usr/share/nginx/html;                                     }         ## set phpmyadmin different path         location /phpmyadmin {         proxy_pass         http://127.0.0.1:8081/phpmyadmin;         #allow 1.1.1.1;         # deny all;                             }         } # end server # second server block        server {     listen 80;     server_name blog.domain.com;         location / {         proxy_set_header   x-real-ip $remote_addr;         proxy_set_header   host      $http_host;         proxy_pass         http://i.p.v.4:8080;                     }         } # end server 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -