Welcome! Log In Create A New Profile

Advanced

WordPress & Nginx (CentOS 7) .PHP downloading instead of executing

Posted by ascon 
WordPress & Nginx (CentOS 7) .PHP downloading instead of executing
January 06, 2016 10:11PM
I've been at this for days. I can't figure out why when i go to my ip for wordpress it downloads the .php, but it works fine when i put in my_ip/phpMyAdmin. I'm not sure what I'm doing wrong or if I configured something wrong. I know i've setup /etc/php.ini and /etc/php-fpm.d/www.conf correctly like most sites recommend and ive tried every solution. most solutions have you modifying the .htaccess file but nginx does not use .htaccess. all permissions and ownership are correct unless im missing something...if anyone can help me out, I can finally leave this room.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
nginx.conf

# Generic startup file.
user nginx nginx;

#usually equal to number of CPUs you have. run command "grep processor /proc/cpuinfo | wc -l" to find it
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Keeps the logs free of messages about not being able to bind().
# daemon off;

events {
worker_connections 1024;
}

http {
# rewrite_log on;

include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
# tcp_nopush on;
keepalive_timeout 3;
# tcp_nodelay on;
# gzip on;
#php max upload limit cannot be larger than this
client_max_body_size 64m;
index index.php index.html index.htm;

# Upstream to abstract backend connection(s) for PHP.
upstream php {
#this should match value of "listen" directive in php-fpm pool
server unix:/var/run/php-fpm/php-fpm.sock;
# server 127.0.0.1:9000;
}

# include sites-enabled/*;
include /etc/nginx/conf.d/*.conf;
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------
phpmyadmin.conf (works)

server {
listen 80;
server_name 192.168.1.215;
root /usr/share/nginx/html;
index index.php index.html index.htm;

location /db-sector {
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/pma_pass;

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
wordpress.conf (doesn't work, downloads index.php)

server {
listen 80;
server_name 192.168.1.215;
root /usr/share/nginx/html;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php?$args;

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

if you need any specifics let me know.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 136
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready