Tenho um VPS com:
- Ubuntu 18.04
- Nginx
- Php7.2-fpm
O servidor executa o projeto Ruby on Rails como homeurl (example.com) e wordpress como diretório (example.com/blog). Primeiro o VPS foi configurado com Apache2, fez tudo funcionar bem, até que tive que integrar um chat ao vivo. Tive que mudar para Nginx para Action Cable.
Agora, o app de chat funciona bem, no RoR, mas se eu tento acessar o blog recebo o arquivo index.php para baixar, ele não executa.
Aqui está minha conf padrão do nginx:
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/asdfsf.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sdafasdf.net/privkey.pem;
root /var/www/html/public;
passenger_enabled on;
passenger_ruby /usr/local/bin/ruby;
location /var/www/html/public {
try_files $uri $uri/ =404;
}
location ~ ^/blog(/.*|$) {
root /var/www/html/public/blog;
try_files $uri $uri/ /blog/index.php?$args;
passenger_enabled off;
index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
Passei 3 noites na solução de problemas, não consigo acertar. Qualquer dica é muito bem vinda. obrigada