You are not logged in.

#1 2013-07-24 06:45:36

SirWuffleton
Member
From: Washington, USA
Registered: 2013-06-05
Posts: 7
Website

[Solved] Nginx and PHP Webapps (PhpMyAdmin, TT-RSS) ignores root dir?

Hi! I've been playing around with Nginx lately, to see if it's a viable option to migrate away from Apache for my personal webserver. I really love the config format, and it feels a lot faster than Apache, but I'm having issues getting any of my PHP-based webapps to work with it. I've followed the guide on the wiki for setting up php-fpm, and tried the config from the PhpMyAdmin page to no avail. All it'll ever do when I navigate to the port for the server is display a highly broken version of my regular site's home page. It's almost as if it's taking JUST the index.php from my regular site, but operating in the directory of the webapp (though is unable to see any of the files there).

I've reverted my site to using apache until I can find a solution to this frustrating issue. Any help would be greatly appreciated.

Relevant config files:

nginx.conf

user http;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    index  index.php index.htm index.html;

    # Main Server
    server {
        listen       80;
        server_name  wuffleton.com;
        root   /srv/http/;

	# Restricted Files/Dirs
	include restricted_areas.conf;

	# Php Support
	include php.conf;

	# Error Pages
	include error_pages.conf;

        # deny access to .htaccess files
        location ~ /\.ht {
            deny  all;
        }
    }

    # HTTPS server
    server {
        listen       443;
        server_name  wuffleton.com;
        root   /srv/http/;

	# SSL Options 
	include ssl-common.conf;

	# Restricted Files/Dirs
	include restricted_areas.conf;

	# Php Support
	include php.conf;

	# Error Pages
	include error_pages.conf;
	
        # deny access to .htaccess files
        location ~ /\.ht {
            deny  all;
        }

    }

    # Strip www. from site
    include no-www.conf;

    # Deluge-Web
    include deluge-web.conf;
    
    # Sage Notebook
    include sage-notebook.conf;
    
    # PhpMyAdmin
    include phpmyadmin.conf;
}

php.conf

location ~ \.php$ {
      try_files      $uri = 404; 
      fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
      fastcgi_index  index.php;
      include        fastcgi.conf;
 }

phpmyadmin.conf

 server {
    listen ###;  
    server_name     wuffleton.com:###;  
    root    /usr/share/webapps/phpMyAdmin;
    index          index.php;

    location ~ \.php$ {
	try_files      $uri =404;
        fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        include        fastcgi.conf;
        fastcgi_param  PHP_ADMIN_VALUE  open_basedir="/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/";
        fastcgi_param HTTPS on;
     }
    include ssl-common.conf;
 }

ssl-common.conf

ssl                  on;
ssl_certificate      /etc/httpd/conf/ssl/server.crt;
ssl_certificate_key  /etc/httpd/conf/ssl/server.key;
ssl_session_timeout  5m;
ssl_protocols  SSLv2 SSLv3 TLSv1;
ssl_ciphers  HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers   on;

Edit: Well, I'm an idiot. Just noticed that I forgot to merge a .pacnew of php.ini, and that was causing all of the problems. After some php configuration woes it seems to be working. Marking this as solved. Just another reason to make sure you always merge those files!

Last edited by SirWuffleton (2013-07-24 19:03:35)

Offline

Board footer

Powered by FluxBB