我有一个带有 centos 7 的虚拟服务器,安装了 nginx + php-fpm,我无法配置 nginx 配置,以便在切换到域时处理 .php 文件,但是,在切换到域时,它提供下载一个带有 php 脚本的文件。
server {
listen 80;
server_name myapptest.gq;
root /usr/share/nginx/html;
index index.php;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
#location / {
# root /usr/share/nginx/html;
# index index.php index.html index.htm;
#}
#location / {
# try_files $uri $uri/ /index.php?q=$uri&$args;
#}
#location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico)$ {
# access_log off;
# expires max;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root php;
#fastcgi_param DOCUMENT_ROOT /myapptest.gq;
#fastcgi_pass unix:/var/run/php-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root php;
#fastcgi_param DOCUMENT_ROOT /myapptest.gq;
#fastcgi_pass unix:/var/run/php-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
那么网络服务器发送什么以及发送给谁?网络通行证被注释掉,套接字访问也是如此。响应。enginx 给出了它从输入文件中接收到的内容,本质上是作为“发布静态的服务器”