Comments (15)
problem in line fastcgi_param
with fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
work good.
in default config after pull line fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
from docker-webserver.
phpMyAdmin is self-container, so despite it uses Apache, it is irrelevant here.
From the log it seems like you don't have 1.php
file in there. I'm wondering why did you put root /data/nginx/www;
in each location instead of directly under server
.
You can try to see if the file is there by entering Nginx container and examining contents:
docker-compose exec nginx ls -al /data/nginx/www
from docker-webserver.
docker-compose exec nginx ls -al /data/nginx/www
drwxr-xr-x 2 git git 4096 Jun 7 06:56 .
drwxr-xr-x 5 git git 4096 Jun 7 06:00 ..
-rw-r--r-- 1 git git 5 Jun 7 06:02 1.html
-rw-r--r-- 1 git git 12 Jun 7 06:37 2.php
-rw-r--r-- 1 root root 90 Jun 7 06:00 index.html
in default config root set in each location.
1.html is well opened
from docker-webserver.
Since files are in place and permissions are correctly it is purely Nginx configuration issue.
Did you restart Nginx after changing its configuration?
from docker-webserver.
Wait, you have 1.html
, but not 1.php
from docker-webserver.
Did you restart Nginx after changing its configuration?
i will stop docker-compose and docker-compose up
after. if i comment location ~ \.php$ {
then php file open for download.
Wait, you have 1.html, but not 1.php
it is test. for all *.php files i get error. How for exists or not exists in server.
from docker-webserver.
server {
listen 80;
server_name localhost;
root /data/nginx/www;
location / {
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
current config
from docker-webserver.
Can you post what is in logs when you try existing file, say, 2.php
?
Because php_1 | 172.19.0.7 - 07/Jun/2017:07:39:58 +0000 "GET /1.php" 404
is actually correct answer for file that indeed doesn't exist.
You don't necessarily need to restart everything, you can just docker-compose restart nginx
, since some other services like database might take longer and you shouldn't really wait for them as configuration is the same.
from docker-webserver.
drwxr-xr-x 2 git git 4096 Jun 7 10:39 .
drwxr-xr-x 5 git git 4096 Jun 7 06:00 ..
-rw-r--r-- 1 git git 5 Jun 7 06:02 1.html
-rw-r--r-- 1 git git 6 Jun 7 10:39 2.php
-rw-r--r-- 1 root root 90 Jun 7 06:00 index.html
-rw-r--r-- 1 git git 12 Jun 7 06:37 index.php
php_1 | 172.19.0.7 - 07/Jun/2017:11:23:43 +0000 "GET /1.php" 404
php_1 | 172.19.0.7 - 07/Jun/2017:11:23:44 +0000 "GET /1.php" 404
php_1 | 172.19.0.7 - 07/Jun/2017:11:23:44 +0000 "GET /1.php" 404
php_1 | 172.19.0.7 - 07/Jun/2017:11:24:04 +0000 "GET /2.php" 404
when run docker-compose restart nginx
nginx_1 | 2017/06/07 06:31:48 [emerg] 1#1: unknown directive "server" in /data/nginx/config/conf.d/default.conf:1
nginx_1 | nginx: [emerg] unknown directive "server" in /data/nginx/config/conf.d/default.conf:1
config
server {
listen 80;
server_name localhost;
root /data/nginx/www;
location / {
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
from docker-webserver.
Did you change anything in /data/nginx/config/nginx.conf
? [emerg] unknown directive "server"
doesn't make any sense.
from docker-webserver.
not problem with EOL. if i comment block with php and restart nginx file *.php dowloaded (config file is well)
in file /data/nginx/config/nginx.conf
i set new config
server {
listen 80;
server_name localhost;
root /data/nginx/www;
location / {
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
in error.log nginx
2017/06/07 12:02:11 [error] 10#10: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.19.0.1, server: localhost, request: "GET /2.php HTTP/1.1", upstream: "fastcgi://172.19.0.6:9000", host: "localhost:81"
from docker-webserver.
This is not a correct config if you put virtual host right into /data/nginx/config/nginx.conf
(see https://stackoverflow.com/questions/10934705/unknown-directive-server-in-etc-nginx-nginx-conf4)
What I'd suggest you to do is to restore original /data/nginx/config/nginx.conf
from /etc/nginx_dist/nginx.conf
and put your virtual host into /data/nginx/config/conf.d/default.conf
. If should work this way.
from docker-webserver.
I do not change that particular line, it comes from base image. I typically replace the whole virtual host file with my own.
from docker-webserver.
Help me with php extension. How i understand me need instal in nazarpc/php:fpm
container? but when i open him with exec bash and write apt-get install php-pgsql get error "Unable to locate package php-pgsql"
from docker-webserver.
This is a separate question and you should better ask it in separate issue so that it would be possible to to find it for other people.
The question about installing additional extensions was already asked here: #20
from docker-webserver.
Related Issues (20)
- mariadb keeps restarting HOT 15
- help chapter in readme for rookie HOT 2
- nginx + php-fpm = 502 HOT 3
- mariadb crash HOT 5
- Question about extends HOT 4
- Data container volume issue HOT 2
- Move everything under /data HOT 5
- Finalize cluster autoscaling v0 HOT 1
- Mount data volume on host HOT 5
- nginx broke after upgrade HOT 34
- pagespeed module HOT 3
- git password for ssh container? HOT 11
- No option for php5? HOT 1
- Why you use data-container instead data named volumes? HOT 1
- A few informative questions (limitation resusrs && ui for containers ) HOT 1
- Advanced Version ? still under development HOT 5
- I can't test nginx config like cmd nignx -t , lets may be fix it? HOT 1
- Сan not connect to my DB via phpmyadmin HOT 4
- Emtpy pages are delivered for PHP scripts HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-webserver.