< H1 > question: < / H1 >
- when docker starts nginx, mime.types reports an error
- include fastcgi_params also reported an error in site configuration
< H2 > 1. Mime.types error related < / H2 >
nginx container error log:
2018/09/25 13:27:27 [emerg] 1-sharp1: open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14
nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14
the nginx.conf file is as follows
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main "$remote_addr - $remote_user [$time_local] "$request" "
"$status $body_bytes_sent "$http_referer" "
""$http_user_agent" "$http_x_forwarded_for"";
-sharp access_log logs/access.log main;
sendfile on;
-sharptcp_nopush on;
-sharpkeepalive_timeout 0;
keepalive_timeout 65;
-sharpgzip on;
server {
-sharp listen 8080;
-sharp server_name localhost;
-sharpcharset koi8-r;
-sharpaccess_log logs/host.access.log main;
-sharp location / {
-sharp root html;
-sharp index index.html index.htm;
-sharp }
-sharperror_page 404 /404.html;
-sharp redirect server error pages to the static page /50x.html
-sharp
-sharp error_page 500 502 503 504 /50x.html;
-sharp location = /50x.html {
-sharp root html;
-sharp }
-sharp proxy the PHP scripts to Apache listening on 127.0.0.1:80
-sharp
-sharplocation ~ \.php$ {
-sharp proxy_pass http://127.0.0.1;
-sharp}
-sharp pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
-sharp
-sharplocation ~ \.php$ {
-sharp root html;
-sharp fastcgi_pass 127.0.0.1:9000;
-sharp fastcgi_index index.php;
-sharp fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
-sharp include fastcgi_params;
-sharp}
-sharp deny access to .htaccess files, if Apache"s document root
-sharp concurs with nginx"s one
-sharp
-sharplocation ~ /\.ht {
-sharp deny all;
-sharp}
}
-sharp HTTPS server
-sharp
-sharpserver {
-sharp listen 443 ssl;
-sharp server_name localhost;
-sharp ssl_certificate cert.pem;
-sharp ssl_certificate_key cert.key;
-sharp ssl_session_cache shared:SSL:1m;
-sharp ssl_session_timeout 5m;
-sharp ssl_ciphers HIGH:!aNULL:!MD5;
-sharp ssl_prefer_server_ciphers on;
-sharp location / {
-sharp root html;
-sharp index index.html index.htm;
-sharp }
-sharp}
include ./conf.d/*;
}
< H2 > 2. Include fastcgi_params error related < / H2 >
nginx container error content
nginx: [emerg] open() "/etc/nginx/fastcgi_params" failed (2: No such file or directory) in /etc/nginx/./conf.d/www.php.cc.conf:23
www.php.cc.conf configuration
server {
listen 80;
server_name www.php.cc;
root /etc/www/php;
location / {
index index.html index.php index.htm;
}
-sharp
error_page 404 /error.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
-sharp pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 172.17.0.3:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}