Closed xtjoeywx closed 6 years ago
Please check your nginx webproxy to see if you set the option on upload limit there.
Restart the proxy and let me know if it works.
I've set things up as is. I mean, I didn't change, enable, or add anything during my set up of the webproxy.
Do I need to uncomment anything? Maybe this?: USE_NGINX_CONF_FILES=true
in the .env file so that it would use the uploadsize.conf file? Also, do I need to add anything to it other than this client_max_body_size 100m;
That´s correct. Please uncomment this option and set the upload size as you need and just restart the webproxy containrs.
If you are in production environment, you might want to try (on the webproxy):
docker-compose restart
So, it will not go off-line while restarting, if it does not work you will need to realod
your webproxy with this command:
docker exec -it webproxy nginx -s reload
Let me know if it worked.
I did as you said. I uncommented that option and set the upload size. Then I restarted the webproxy containers as well as the wordpress containers. I used docker-compose restart
within the folders. Then I tried uploading the plugin and I got the same "413 Request Entity Too Large" error.
I also tried reloading them with this:
docker exec -it nginx-web -s reload
But I got this error in terminal: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"-s\": executable file not found in $PATH": unknown
I then stopped all of the containers and started them again to see if that would work. Still the same result.
This is my .env file:
#
# docker-compose-letsencrypt-nginx-proxy-companion
#
# A Web Proxy using docker with NGINX and Let's Encrypt
# Using the great community docker-gen, nginx-proxy and docker-letsencrypt-nginx-proxy-companion
#
# This is the .env file to set up your webproxy enviornment
#
# Your local containers NAME
#
NGINX_WEB=nginx-web
DOCKER_GEN=nginx-gen
LETS_ENCRYPT=nginx-letsencrypt
#
# Your external IP address
#
IP=0.0.0.0
#
# Default Network
#
NETWORK=webproxy
#
# Service Network (Optional)
#
# In case you decide to add a new network to your services containers you can set this
# network as a SERVICE_NETWORK
#
# [WARNING] This setting was built to use our `start.sh` script or in that special case
# you could use the docker-composer with our multiple network option, as of:
# `docker-compose -f docker-compose-multiple-networks.yml up -d`
#
#SERVICE_NETWORK=webservices
#
# NGINX file path
#
NGINX_FILES_PATH=/nginx/data
#
# NGINX use special conf files
#
# In case you want to add some special configuration to your NGINX Web Proxy you could
# add your files to ./conf.d/ folder as of sample file 'uploadsize.conf'
#
# [WARNING] This setting was built to use our `start.sh`.
#
# [WARNING] Once you set this options to true all your files will be copied to data
# folder (./data/conf.d). If you decide to remove this special configuration
# you must delete your files from data folder ./data/conf.d.
#
USE_NGINX_CONF_FILES=true
#
# Docker Logging Config
#
# This section offers two options max-size and max-file, which follow the docker documentation
# as follow:
#
# logging:
# driver: "json-file"
# options:
# max-size: "200k"
# max-file: "10"
#
#NGINX_WEB_LOG_MAX_SIZE=4m
#NGINX_WEB_LOG_MAX_FILE=10
#NGINX_GEN_LOG_MAX_SIZE=2m
#NGINX_GEN_LOG_MAX_FILE=10
#NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m
#NGINX_LETSENCRYPT_LOG_MAX_FILE=10
This is my docker-compose.yml file:
version: '3'
services:
nginx-web:
image: nginx
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
container_name: ${NGINX_WEB:-nginx-web}
restart: always
ports:
- "${IP:-0.0.0.0}:80:80"
- "${IP:-0.0.0.0}:443:443"
volumes:
- ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
- ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
- ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
- ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro
- ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro
logging:
options:
max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m}
max-file: ${NGINX_WEB_LOG_MAX_FILE:-10}
nginx-gen:
image: jwilder/docker-gen
command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
container_name: ${DOCKER_GEN:-nginx-gen}
restart: always
volumes:
- ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
- ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
- ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
- ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro
- ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
logging:
options:
max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m}
max-file: ${NGINX_GEN_LOG_MAX_FILE:-10}
nginx-letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: ${LETS_ENCRYPT:-nginx-letsencrypt}
restart: always
volumes:
- ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
- ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
- ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
- ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-gen}
NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-web}
logging:
options:
max-size: ${NGINX_LETSENCRYPT_LOG_MAX_SIZE:-2m}
max-file: ${NGINX_LETSENCRYPT_LOG_MAX_FILE:-10}
networks:
default:
external:
name: ${NETWORK:-webproxy}
This is my uploadsize.conf file:
client_max_body_size 1000M
Now onto my wordpress files. Here is my wordpress docker-compose.yml file:
version: '3'
services:
db:
container_name: ${CONTAINER_DB_NAME}
image: mariadb:latest
restart: unless-stopped
volumes:
- ${DB_PATH}:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
wordpress:
depends_on:
- db
container_name: ${CONTAINER_WP_NAME}
image: wordpress:latest
restart: unless-stopped
volumes:
- ${WP_CORE}:/var/www/html
- ${WP_CONTENT}:/var/www/html/wp-content
- ./conf.d/uploadsize.ini:/usr/local/etc/php/conf.d/uploadsize.ini
environment:
WORDPRESS_DB_HOST: ${CONTAINER_DB_NAME}:3306
WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
WORDPRESS_DB_USER: ${MYSQL_USER}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX}
VIRTUAL_HOST: ${DOMAINS}
LETSENCRYPT_HOST: ${DOMAINS}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
networks:
default:
external:
name: ${NETWORK}
Here is my wordpress .env file:
# .env file to set up your wordpress site
#
# Network name
#
# Your container app must use a network conencted to your webproxy
# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
#
NETWORK=webproxy
#
# Database Container configuration
# We recommend MySQL or MariaDB - please update docker-compose file if needed.
#
CONTAINER_DB_NAME=db
# Path to store your database
DB_PATH=/wordpress/database/data
# Root password for your database
MYSQL_ROOT_PASSWORD=mypassword
# Database name, user and password for your wordpress
MYSQL_DATABASE=mydatabasename
MYSQL_USER=myusername
MYSQL_PASSWORD=mypassword
#
# Wordpress Container configuration
#
CONTAINER_WP_NAME=wordpress
# Path to store your wordpress files
WP_CORE=/wordpress/core/data
WP_CONTENT=/wordpress/wp-content/data
# Table prefix
WORDPRESS_TABLE_PREFIX=wp_
# Your domain (or domains)
DOMAINS=mydomain.com,www.mydomian.com
# Your email for Let's Encrypt register
LETSENCRYPT_EMAIL=myemail@mydomain.com
Here is my wordpress uploadsize.ini file:
file_uploads = On
memory_limit = 3000M
upload_max_filesize = 1000M
post_max_size = 2000M
max_execution_time = 1000
You miss the nginx
command:
Try again coping and pasting this line:
docker exec -it nginx-web nginx -s reload
I assume you have fixed that... if not open this issue again and comment.
Thanks!
Sorry, I haven't been able to get back to this until now. Yes, that did fix it. Thank you! :+1:
Hi I had the same issue and fixed the ngnix limitation with the steps above, but I relaized that I forgot to add the conf.d folder to the wp folder. I added it, but now, if I run docker-compose restart I get the folowing error:
ERROR: for wordpress Cannot start service wordpress: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/home/*/*/*/conf.d/uploadsize.ini\\\" to rootfs \\\"/var/lib/docker/overlay2/*/merged\\\" at \\\"/var/lib/docker/overlay2/*/merged/usr/local/etc/php/conf.d/uploadsize.ini\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
How can I fix this?
@Koerner can you show how your docker-compose is looking?
`version: '3'
services: db: container_name: ${CONTAINER_DB_NAME} image: mariadb:latest restart: unless-stopped volumes:
${DB_PATH}:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
wordpress: depends_on:
networks: default: external: name: ${NETWORK}`
.env: (extract)
# Path to store your wordpress files WP_CORE=/wp/wp-core WP_CONTENT=/wp/wp-content
Hi, I solved it by the following steps:
docker system prune
docker-compose up -d
(in correct folder)I have an update on this.
I found out why I was having an issue in the first place.
I was installing the nginx files under the root user here: /nginx/data
Then I installed wordpress under the sudo user here: /home/myuser/wordpress_site
Therefore, I believe it was a permission problem. Wordpress wasn't able to access the webproxy's config files to read the uploadsize.conf
file because it didn't have root permission.
The fix: I installed both the webproxy and wordpress under the sudo user and I had no more problems.
I hope this helps someone else.
Or you could have a www-data owner and group for the wp files.
I'm trying to upload a large plugin and it won't let me. I'm getting an nginx error page.
To recreate: Upload a plugin using wordpress's plugin uploader. The one I used is 4.3 MB. (.zip)
I'm thinking the solution would be to increase php limits, but they are already high enough in your default uploadsize.ini file.
Thanks for your work on this. It's awesome!