2017-02-06 2 views
0

Ich habe versucht, Nginx auf PHP-Website auf Mac OS zu dienen. Aber wenn ich eine PHP-Datei vom Browser öffnen, zeigt es eine leere Seite ohne Fehler. Ich habe php und nginx bezogene Anwendung installiert. Unten ist mein PHP-Datei:Fehler beim Einrichten von PHP auf Nginx auf Mac OX

<?php 
phpinfo(); 
?> 

unter Datei meine nginx config:

http{ 
     server{ 
       listen 8082; 
       root /Users/joey/tmp; 
     location/{ 
      index index.html index.htm index.php; 
     } 
       location ~ \.php$ { 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
       include /usr/local/etc/nginx/fastcgi_params; 
         autoindex on; 
       } 


     } 
} 
events { 
    worker_connections 1024; 
} 

ich verifed haben, dass php-fpm begonnen hat und lauscht auf Port 9000:

$ lsof -Pni4 | grep LISTEN | grep php 
php-fpm 43310 joey 6u IPv4 0xdcff1b2732b9c88d  0t0 TCP 127.0.0.1:9000 (LISTEN) 
php-fpm 43311 joey 0u IPv4 0xdcff1b2732b9c88d  0t0 TCP 127.0.0.1:9000 (LISTEN) 
php-fpm 43312 joey 0u IPv4 0xdcff1b2732b9c88d  0t0 TCP 127.0.0.1:9000 (LISTEN) 
php-fpm 43313 joey 0u IPv4 0xdcff1b2732b9c88d  0t0 TCP 127.0.0.1:9000 (LISTEN) 

unten ist mein PHP und Nginx Version:

$ nginx -v 
nginx version: nginx/1.10.2 
$ php -version 
PHP 5.6.29 (cli) (built: Dec 9 2016 07:03:56) 
Copyright (c) 1997-2016 The PHP Group 
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies 

Ist an meiner Konfiguration etwas nicht in Ordnung?

Antwort

0

Nach einiger Suche fand ich brauche ich unter Konfiguration auf nginx.conf Datei php Anfrage zu aktivieren:

location ~ \.php$ { 
         fastcgi_pass 127.0.0.1:9000; 
         fastcgi_param REQUEST_METHOD $request_method; 
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
         fastcgi_index index.php; 
         include /usr/local/etc/nginx/fastcgi_params; 
         autoindex on; 
       } 
Verwandte Themen