我有一個適用於Ubuntu,Nginx,PHP-FPM和MySQL的Docker設置。允許WordPress對Docker掛載文件夾的寫入權限
的WordPress可以寫上傳文件夾,我可以在網上編輯模板,但是當我嘗試升級的WordPress或插件,它失敗:
開箱更新...
無法創建目錄:WordPress的
安裝失敗
我chmod 777
整個WordP ress文件夾,所以我不確定這是Docker還是WordPress相關的。我也檢查過各種日誌,但我發現的唯一相關行是這樣的:
192.168.59.3 - - [01/Oct/2014:14:16:58 +0000]「POST/wp-admin/(Macintosh;英特爾Mac OS X 10_10_0)AppleWebKit/537.36((http://support.microsoft.com/kb/CHS/EN-US/WINDOWS/) KHTML,像壁虎 )的Chrome/Safari瀏覽器37.0.2062.124/537.36"
下面是如何創建的多克爾環境:
brew install docker boot2docker
boot2docker init
# Allow VM access to our space
curl http://static.dockerfiles.io/boot2docker-v1.2.0-virtualbox-guest-additions-v4.3.14.iso > ~/.boot2docker/boot2docker.iso
VBoxManage sharedfolder add boot2docker-vm -name home -hostpath /Users
boot2docker up
下面是如何啓動容器:
docker run -p 80:80 --name wp -d -v ~/wordpress:/mnt/www:rw wp
這裏是Nginx的配置:
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /mnt/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.php?q=$uri&$args;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}