elsparkodiablo
Active member
I am simply trying to move an XF 2 installation and use nginx instead of Apache.
Following the link here:
https://www.nginx.com/resources/wiki/start/topics/recipes/xenforo/
I configure nginx to pass off to php-fpm when it encounters a php file. However, using this directive:
The php is never sent to php-fpm with fastcgi_pass, but instead the index.php file is served up as plain text. I've seen that this location directive is required with $uri&$args to allow Xenforo to work. Is there an updated page anywhere that suggests a different approach?
Any help would be greatly appreciated. Thanks!
Following the link here:
https://www.nginx.com/resources/wiki/start/topics/recipes/xenforo/
I configure nginx to pass off to php-fpm when it encounters a php file. However, using this directive:
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}
The php is never sent to php-fpm with fastcgi_pass, but instead the index.php file is served up as plain text. I've seen that this location directive is required with $uri&$args to allow Xenforo to work. Is there an updated page anywhere that suggests a different approach?
Any help would be greatly appreciated. Thanks!
Code:
server {
listen 80;
listen [::]:80;
server_name dev.mysite.com;
#listen 443 ssl http2;
#listen [::]:443 ssl http2;
root /usr/share/nginx/mysite.com;
index index.php index.html;
error_log /var/log/nginx/mysite-error.log info;
location ~ / {
try_files $uri $uri/ /index.php?$uri&$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}