Tentando obter uma instalação de Ubuntu 18.04
para Wordpress
em um host Win 10
. O host compartilha uma pasta com a VM, que é a raiz de vários projetos. Esta é uma nova VM criada a partir da imagem std Ubuntu 18/04 LTS x64 Server
.
Eu instalo nginx
e posso ver o Welcome page
. Em seguida, excluo a pasta /var/www/html
e recrio usando um link simbólico para minha pasta compartilhada:
sudo ln -s /media/sf_Wordpress /var/www/html
Quando eu navego no meu servidor, recebo 502 Bad Gateway
.
Se eu cd
em /var/www/hmtl
recebo permission denied
. Se eu mudar para root
, posso acessar a pasta e listar todos os arquivos no compartilhamento.
Meu nginx
log diz:
papa@wp:~$ tail -f /var/log/nginx/error.log
2018/05/30 05:05:05 [crit] 766#766: *4 stat() "/var/www/html/mysite1/" failed (13: Permission denied), client: 192.168.0.5, server: mysite1.com.au, request: "GET / HTTP/1.1", host: "mysite1.com.au"
2018/05/30 05:05:05 [crit] 766#766: *4 stat() "/var/www/html/mysite1/" failed (13: Permission denied), client: 192.168.0.5, server: mysite1.com.au, request: "GET / HTTP/1.1", host: "mysite1.com.au"
2018/05/30 05:05:05 [error] 766#766: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.5, server: mysite1.com.au, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysite1.com.au"
2018/05/30 05:05:05 [crit] 766#766: *4 connect() to unix:/tmp/php-cgi.socket failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.5, server: mysite1.com.au, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.socket:", host: "mysite1.com.au"
Eu adicionei www-data
a vboxsf
group. Nenhuma diferença.
A verificação do processo nginx
indica que ele está sendo executado por root
:
papa@wp:~$ ps -eo pid,comm,euser,supgrp | grep nginx
1888 nginx root root
1891 nginx www-data www-data,vboxsf
Usando a sugestão de aqui , eu corri:
sudo chown -R www-data:www-data /var/www/html
Mas não fez diferença. Ainda 502 Bad gateway
.
A execução de nginx -t
mostra:
papa@wp:~$ nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/05/30 07:37:21 [warn] 1905#1905: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2018/05/30 07:37:21 [emerg] 1905#1905: open() "/etc/nginx/sites-enabled/fca.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
Meu nginx
config fca.conf
para este site é:
# Upstream to abstract backend connection(s) for php
upstream php {
server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9000;
}
server {
## Your website name goes here.
server_name mysite1.com.au;
## Your only path reference.
root /var/www/html/mysite1;
## This should be in your http block and if it is, it's not needed here.
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}