丑陋的孔雀分享 http://blog.sciencenet.cn/u/smallland
↙中国的社会生物学保卫战↘

博文

与apache不同,nginx每个alias都要定义cgi,否则php文件找不到

已有 2613 次阅读 2020-4-24 10:24 |系统分类:科普集锦

windows测试用,alias目录总是不能运行php,原来每个alias都要定义


#run bat file: d:\apache24php7\php7\php-cgi.exe -b 127.0.0.1:9000 -c 

#modify: d:/apache24php7/php7/php.ini (似乎不改定义也行)

# php.ini: cgi.fix_pathinfo=1


#user  nobody;

worker_processes  1;


#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;


    server {

        listen       8080;

        server_name  localhost;

root d:/apache24php7/webroot;

#document_root, disable /location root and /php root


        #charset koi8-r;


        #access_log  logs/host.access.log  main;


        location / {


            index index.php index.html index.htm;

        }


location /bb {

    alias D:/bb/;

    index index.php;

    location ~ \.php$ {

        #fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_pass   127.0.0.1:9000;

        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $request_filename;

        #fastcgi_intercept_errors on;

    }

}


        #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   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

        #jyj location ~ /biaohen/.+\.php$ {

        location ~* \.php$ {

            #jyj root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

    fastcgi_param  SCRIPT_FILENAME  $document_root$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;

        #}

    }



    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}



    # HTTPS server

    #

    #server {

    #    listen       443 ssl;

    #    server_name  localhost;


    #    ssl_certificate      cert.pem;

    #    ssl_certificate_key  cert.key;


    #    ssl_session_cache    shared:SSL:1m;

    #    ssl_session_timeout  5m;


    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers  on;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}

}




https://wap.sciencenet.cn/blog-524394-1229883.html

上一篇:动物的攻击性与规则意识
下一篇:windows下mysql5.7配置
收藏 IP: 222.173.104.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-3-29 14:11

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部