PeeHaa / OpCacheGUI

GUI for PHP's OpCache
1.46k stars 170 forks source link

Nginx with php-fpm server block configuration? #12

Closed hyperfocus1338 closed 10 years ago

hyperfocus1338 commented 10 years ago

Do you have instructions to configure this under Nginx with php-fpm? A serverblock for Nginx opposed to an Apache virtualhost.

PeeHaa commented 10 years ago

If you are planning to run it on a dedicated subdomain you can use something like this:

server {
    listen 80;

    server_name opcachegui.domain.com;
    root /srv/www/OpCacheGUI/public;

    location ~ ^/(.*).php($|/) {
        fastcgi_split_path_info ^(.+.php)(.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass   127.0.0.1:9000;
        include        fastcgi_params;
    }

    location / {
       index index.php;
            try_files $uri /index.php?$args;
    }
}
ewwink commented 10 years ago

how if in subdirectory?

hussanhijazi commented 10 years ago

+1

ViktorAksionov commented 10 years ago

settings for subdirectory which works fine for me:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
#in this example path for root folder
    root /var/www/yourdomain.com/public_html;
    index index.php index.html index.htm;
    server_name yourdomain.com;
    access_log /var/log/nginx/yourdomain.com_access.log;
    error_log /var/log/nginx/yourdomain.com_error.log;
#lets say your files are here: /var/www/yourdomain.com/public_html/opcachegui/public
#so they will be avaialble from URI : yourdomain.com/opcachegui/public
    location /opcachegui/public {
        index index.php;
        try_files $uri $uri/ /opcachegui/public/index.php?$query_string;
    }
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
ffflabs commented 10 years ago

+1 I got it working with a similar syntax

location / {
           try_files $uri $uri/ /index.php?$request_uri;
      }