New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx return file not found with nginx-proxy #1576
Comments
Does restarting the docker daemon solve this? |
In a similar setup I discovered that the template probably doesn't set the right Lines 63 to 67 in c4ad18f
Adding the following line allows php-fpm to know which file to process:
Also, this redirects every request to the fastcgi container, including '/', and php-fpm obviously refuses to serve them:
I think the template needs an additional location block on fastcgi server generation for scripts only or non-script files, with a env.var for the container like docker-compose.yml block app:
image: next-fpm
volumes:
- data:/var/www/html
environment:
- VIRTUAL_HOST=next.domain
- LETSENCRYPT_HOST=next.domain
- VIRTUAL_PROTO=fastcgi
- VIRTUAL_ROOT=/var/www/html
- VIRTUAL_DEST=/var/www/html Generated server config server {
server_name next.domain;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_certificate /etc/nginx/certs/next.domain.crt;
ssl_certificate_key /etc/nginx/certs/next.domain.key;
ssl_dhparam /etc/nginx/certs/next.domain.dhparam.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/certs/next.domain.chain.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
include /etc/nginx/vhost.d/default;
location / {
root /var/www/html;
include fastcgi_params;
fastcgi_pass next.domain;
} |
I'm using nginx-proxy to run multiple sites/app on a single nginx instance. So far, I was able to run a static site and a nodejs application without problems but I'm facing an issue with a php application created with codeigniter.
Essentially the project structure looks like this:
inside the
nginx-proxy/docker-compose.yml
I have the content suggested by the author:this actually contains the
nginx
service, thenginx-gen
which check if there are new configuration on theproxy
network and generate the ssl certificate automatically through thenginx-letsencrypt
.Inside the
php-application/docker-compose.yml
I have this:The php application runs over
php-fpm
specifically on the port9000
usingfastcgi
, for this I used the following directives:to make it working, I also specified the
VIRTUAL_ROOT
that should redirect all the request on the index.php which is available in this directory/var/www/html/public
. Project structure:the problem's that when I start the
php-application
container usingdocker-compose up --build -d
, I get this when I visitmysite.com
(hide for privacy the real domain):Inspecting the
nginx
log usingsudo docker logs -f nginx
I get:what I did wrong?
UPDATE:
output of /var/log/nginx/error.lg
UPDATE 2
The text was updated successfully, but these errors were encountered: