LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 05-01-2014, 11:34 PM   #1
skinney
Member
 
Registered: Oct 2012
Location: oakland,ca
Distribution: Arch, Ubuntu Server 12.04, Slack64-14.1
Posts: 86

Rep: Reputation: Disabled
Slack14.1 nginx works but no php


slack 14.1 x64, nginx 1.6, php 5.4.27
Installed nginx from slackbuild
php was already installed
nginx works but i can't get php files to load. I've been all over trying different configs. here's my current state.
> ps aux | grep [p]hp
Code:
root      2130  0.0  1.7 243228  8952 ?        Ss   13:48   0:00 php-fpm: master process (/etc/php-fpm/php-fpm.conf)                                            
nobody    2131  0.0  1.6 243228  8580 ?        S    13:48   0:00 php-fpm: pool www                                                                              
nobody    2132  0.0  1.6 243228  8408 ?        S    13:48   0:00 php-fpm: pool www
> ps aux | grep [n]ginx
Code:
root      1692  0.0  0.2  23964  1504 pts/3    S    11:36   0:00 sudo emacs /etc/nginx/nginx.conf
root      1693  0.1  6.4 288072 32844 pts/3    S+   11:36   0:14 emacs /etc/nginx/nginx.conf
root      2137  0.0  0.4  57624  2104 ?        Ss   13:48   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nobody    2138  0.0  0.6  58008  3452 ?        S    13:48   0:00 nginx: worker process
> /etc/nginx.conf
Code:
#user  nobody;
worker_processes  4;

#error_log  logs/error.log;                                                                                                                                    
#error_log  logs/error.log  notice;                                                                                                                            
#error_log  logs/error.log  info;                                                                                                                              

#pid        logs/nginx.pid;                                                                                                                                    


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                                                                                 
    #                  '$status $body_bytes_sent "$http_referer" '                                                                                             
    #                  '"$http_user_agent" "$http_x_forwarded_for"';                                                                                           

    #access_log  logs/access.log  main;                                                                                                                        

    sendfile        on;
    #tcp_nopush     on;                                                                                                                                        

    #keepalive_timeout  0;                                                                                                                                     
    keepalive_timeout  65;

    #gzip  on;
...
 include /etc/nginx/conf.d/*.conf;
 include /etc/nginx/sites-enabled/*.conf;
...
i sniped the commented out blocks
> /etc/nginx/sites-enabled/dokuwiki.conf
Code:
server {
  server_name dokuwiki;
  listen 80;
  autoindex off;
  client_max_body_size 15M;
  client_body_buffer_size 128k;
  index index.html index.htm index.php doku.php;
  access_log  /var/log/nginx/dokuwiki/access.log;
  error_log  /var/log/nginx/dokuwiki/error.log;
  root /var/www/dokuwiki;

location / {
  try_files $uri $uri/ @dokuwiki;
}

location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
  expires 30d;
}

location = /robots.txt  { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\.          { access_log off; log_not_found off; deny all; }
location ~ ~$           { access_log off; log_not_found off; deny all; }

location @dokuwiki {
  rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
  rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
  rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
  rewrite ^/(.*) /doku.php?id=$1 last;
}

location ~ \.php$ {
  try_files $uri =404;
  #fastcgi_pass   unix:/var/run/php-fpm/dokuwiki.sock;                                                                                                         
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include /etc/nginx/fastcgi_params;
  fastcgi_param  QUERY_STRING     $query_string;
  fastcgi_param  REQUEST_METHOD   $request_method;
  fastcgi_param  CONTENT_TYPE     $content_type;
  fastcgi_param  CONTENT_LENGTH   $content_length;
  fastcgi_intercept_errors        on;
  fastcgi_ignore_client_abort     off;
  fastcgi_connect_timeout 60;
  fastcgi_send_timeout 180;
  fastcgi_read_timeout 180;
  fastcgi_buffer_size 128k;
  fastcgi_buffers 4 256k;
  fastcgi_busy_buffers_size 256k;
  fastcgi_temp_file_write_size 256k;
}

location ~ /(data|conf|bin|inc)/ {
  deny all;
}

location ~ /\.ht {
  deny  all;
}

}
in /var/www/dokuwiki/index.php
Code:
<? phpinfo() ?>
where am i going wrong?
I'd also like to use a unix socket instaed of tcp over 127.0.0.1:9000
which i confirmed is is up and listening with
> netstat -lnp | grep 9000

If you all have input on how to tell php to listen on a .sock I'd love to hear it

Last edited by skinney; 05-02-2014 at 12:29 AM.
 
Old 05-02-2014, 08:54 AM   #2
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 422

Rep: Reputation: 58
I'm running apache/php-fpm instead of nginx/php-fpm but the concept is similar. nginx calls fastcgi, is that the right module? Here's an apache/mod_proxy_fcgi .htaccess rewrite rule as an example.

Code:
RewriteRule ^(.*\.php)$ fcgi://localhost:9000/var/www/$1 [P,L]
Hope that helps.

Last edited by Chuck56; 05-02-2014 at 08:59 AM.
 
Old 05-02-2014, 09:02 AM   #3
skinney
Member
 
Registered: Oct 2012
Location: oakland,ca
Distribution: Arch, Ubuntu Server 12.04, Slack64-14.1
Posts: 86

Original Poster
Rep: Reputation: Disabled
in nginx vhost .conf it's in the 'location' block inside the 'server' block
Code:
location ~ \.php$ {
  try_files $uri =404;
  #fastcgi_pass   unix:/var/run/php-fpm/dokuwiki.sock;                                                                                                         
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include /etc/nginx/fastcgi_params;
  fastcgi_param  QUERY_STRING     $query_string;
  fastcgi_param  REQUEST_METHOD   $request_method;
  fastcgi_param  CONTENT_TYPE     $content_type;
  fastcgi_param  CONTENT_LENGTH   $content_length;
  fastcgi_intercept_errors        on;
  fastcgi_ignore_client_abort     off;
  fastcgi_connect_timeout 60;
  fastcgi_send_timeout 180;
  fastcgi_read_timeout 180;
  fastcgi_buffer_size 128k;
  fastcgi_buffers 4 256k;
  fastcgi_busy_buffers_size 256k;
  fastcgi_temp_file_write_size 256k;
}
this douwiki.conf i got right from dokuwikis site. i have nginx and php5-fpm running great in an unbuntu container. nginx and php was installed from ubuntu repos.

it must be a php config issue.

Last edited by skinney; 05-02-2014 at 09:03 AM.
 
Old 05-02-2014, 10:09 AM   #4
skinney
Member
 
Registered: Oct 2012
Location: oakland,ca
Distribution: Arch, Ubuntu Server 12.04, Slack64-14.1
Posts: 86

Original Poster
Rep: Reputation: Disabled
the code in index.php was wrong!

ahhh

this works
Code:
<?php
  phpinfo();
?>
 
  


Reply

Tags
nginx, php, slackware


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx + php-fpm and nginx modules fantasygoat Linux - Server 0 06-09-2011 01:21 PM
Nginx experts help me-problem when using Nginx php-fpm !!! HuMan-BiEnG Linux - Server 2 04-17-2011 03:30 PM
NGINX with PHP-FPM vis NGINX with Spawn-FCGI WhisperiN Linux - Server 1 03-15-2011 07:39 PM
LXer: Installing Nginx With PHP 5.3 And PHP-FPM On Ubuntu Lucid Lynx (10.04) LXer Syndicated Linux News 0 06-15-2010 12:42 AM
LXer: Installing PHP 5.3, Nginx And PHP-fpm On Ubuntu/Debian LXer Syndicated Linux News 0 02-10-2010 06:40 PM


All times are GMT -5. The time now is 12:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration