Reputation: 20555
So i am trying to setup my application.
i run the command sudo docker-compose ps
i get the following output
It looks as if everything is up and running however if i go to localhost at port 8000 i get the following screen:
I am using nginx
and here is my configuration:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#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;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
Note if i go to localhost (without portnumber) it shows me that my nginx has been installed correctly (the default nginx screen)
Can anyone tell me what i am missing?
Upvotes: 0
Views: 1833
Reputation: 2442
You need to map the port from the host to the running container.
docker run -d -p 5801:5801 -p 5802:5802 .....
Also if your workstation/laptop has more than one network card, make sure you map it to the correct one that you are trying to access it from:
docker run -d -p <interface IP>:<outside port>:<inside port> .....
See this article for more info: https://forums.docker.com/t/how-to-expose-port-on-running-container/3252/5
Upvotes: 2