小编Sha*_*Gil的帖子

Nginx下载php而不是运行它

我在Linux REHL机器上设置了一个Nginx php服务器.当访问html文件一切顺利,但尝试访问php文件时,文件被下载而不是被执行.

这是我的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;
}
Run Code Online (Sandbox Code Playgroud)

......这是服务器块:

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 ~ …
Run Code Online (Sandbox Code Playgroud)

php linux fastcgi nginx

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

fastcgi ×1

linux ×1

nginx ×1

php ×1