Когда моя виртуальная машина не создана , я могу запустить:
vagrant up
или:
vagrant up --provision
, но не ] vagrant Provision
из-за предупреждения:
VM не создана. Двигаемся дальше ... Невозможно создать каталог wp-content / uploads / 2016/06 Конфигурации такие. Для сервера /etc/nginx/conf.d/default.conf {...
Я продолжал получать эту ошибку при загрузке фотографии на свой сайт.
Невозможно создать каталог wp-content / uploads / 2016 / 06
Конфигурации такие. Для
/etc/nginx/conf.d/default.conf
server { server_name vnfintech.com www.vnfintech.com; root /usr/share/nginx/html; index index.php; access_log /var/log/nginx/vnfintech.com.access.log; error_log /var/log/nginx/vnfintech.com.error.log debug; client_max_body_size 20M; set $cache_uri $request_uri; # POST requests and URLs with a query string should always go to PHP if ($request_method = POST) { set $cache_uri 'null cache'; } if ($query_string != "") { set $cache_uri 'null cache'; } # Don't cache URIs containing the following segments if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php |sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { set $cache_uri 'null cache'; } # Don't use the cache for logged-in users or recent commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+ |wp-postpass|wordpress_logged_in") { set $cache_uri 'null cache'; } # Use cached or actual file if it exists, otherwise pass request to WordPress location / { try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } location ~ .php$ { try_files $uri /index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; #include fastcgi_params; #fastcgi_pass 127.0.0.1:7777; } # Cache static files for as long as possible location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { expires max; log_not_found off; access_log off; } }
Для
/etc/nginx/nginx.conf
user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/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"'; access_log /var/log/nginx/access.log main; client_max_body_size 20M; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; }
php-fpm
процессаps aux | grep php-fpm root 9616 0.0 0.0 283908 5828 ? Ss 03:40 0:00 php-fpm: master process (/etc/php-fpm.conf) nginx 9646 1.3 0.1 349956 64200 ? S 03:40 0:10 php-fpm: pool www nginx 9647 1.3 0.1 349956 64100 ? S 03:40 0:10 php-fpm: pool www nginx 9656 1.0 0.1 348928 62884 ? S 03:40 0:08 php-fpm: pool www
Разрешение
wp-upload
- этоchmod -R
как 775 иchown -R
какnginx: nginx
ls -l /usr/share/nginx/html/wp-content/uploads/ total 60 drwxrwxr-x. 6 nginx nginx 4096 Jun 18 01:57 2015 drwxrwxr-x. 3 nginx nginx 4096 Jun 18 01:57 2016
Что не так, что я не могу загружать фотографии на сервер?
Это проблема с правами доступа к файлам, вероятно, в связи с пользователем / группой, от имени которой работает ваш веб-сервер. Прочтите мое руководство по Wordpress, в котором есть раздел разрешений .
Вот суть того, что я делаю для настройки разрешений. У меня есть сценарий, который я могу запустить в любое время.
Установить один, настроить пользователей и группы
useradd tim (NB: you can name the user something else if you like!)
passwd tim (NB: give them a secure password, but you'll never need to use it)
groupadd www-data
usermod -a -G www-data nginx (add the nginx user to the www-data group)
chown -R tim /usr/share/nginx/
chgrp -R www-data /usr/share/nginx/
chmod -R 750 /usr/share/nginx/
chmod -R g+s /usr/share/nginx/
Установить два, установить права доступа к файлам для Wordpress
chown -R tim /usr/share/nginx/
chgrp -R www-data /usr/share/nginx/
find /usr/share/nginx/html/wordpress -type d -exec chmod 755 {} \;
find /usr/share/nginx/html/wordpress -type f -exec chmod 644 {} \;
find /usr/share/nginx/html/wordpress/wp-content/uploads -type f -exec chmod 664 {} \;
find /usr/share/nginx/html/wordpress/wp-content/plugins -type f -exec chmod 664 {} \;
find /usr/share/nginx/html/wordpress/wp-content/themes -type f -exec chmod 644 {} \;
chmod 440 /usr/share/nginx/html/wordpress/wp-config.php (NB: restrict access to this information as much as possible)
chmod -R g+s /usr/share/nginx/html/wordpress/ NB: this should make new directories take on permissions already defined
Вероятно, ваша проблема будет в SELinux.
/ usr / share / nginx / html;
Это нестандартное место для размещения файлов, связанных с Интернетом (в CentOS), которые обычно идет в / var / www / html. Таким образом, политика по умолчанию не позволяет httpd_t (nginx) записывать в файлы и каталоги usr_t.
Вы можете переместить свои файлы в / var / www / html ... и запустить restorecon, или вы можете добавить новое регулярное выражение в База данных SELinux для установки контекстов файлов для корневого пути
semanage fcontext -a -t httpd_sys_content_t "/usr/share/nginx/html(/.*)?"
restorecon -rv /usr/share/nginx/html