Nginx-downloads, php, anstatt es

Iv ' E setup eines Nginx php-server auf einem linux-REHL-Maschine.
Beim Zugriff auf html-Dateien geht alles gut, aber versuchen, Zugriff auf php Datei, wird die Datei heruntergeladen und nicht ausgeführt wird.

Dies ist meine nginx.conf:

user  nginx;
worker_processes  1;

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


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

...und dies ist der server-block:

server {
    listen       80;
    server_name  {mywebsitename};

    #access_log  logs/host.access.log  main;

    location / {
        root   /usr/share/nginx/html/{mywebsitename}/;
    }

    location /ngx_status_2462 {
      stub_status on;
      access_log   off;
      allow all;
    }

    location ~ \.php$ {
#                fastcgi_pass unix:/var/run/php5-fpm.sock;

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/{mywebsitename}$fastcgi_script_name;
        include fastcgi_params;
        }

        error_page  404              /404.html;

        location = /404.html {
            root   /usr/share/nginx/html;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    }
  • So dies ist nur ein kleiner Punkt, Sie schrieb root /usr/share/nginx/html/{mywebsitename}/; also bin ich davon ausgegangen {mywebsitename} nicht enthalten einen abschließenden /, so {mywebsitename}$fastcgi_script_name; sollte {mywebsitename}/$fastcgi_script_name; Recht ? (Hinzugefügt slash)
InformationsquelleAutor Sharon Gil | 2014-01-13
Schreibe einen Kommentar