nginx不支持yii怎么办

nginx不支持yii怎么办

nginx不支持yii怎么办?nginx部署yii2的方法

只需要修改nginx.config配置文件内容,在里面增加server,并且root写成index.php文件在的目录下就可以

还要设置config/web.php里的cookieValidationKey值,以及一些目录的访问权限需要设置成777

nginx配置文件内容

灵办AI 灵办AI

免费一键快速抠图,支持下载高清图片

灵办AI 78 查看详情 灵办AI

#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       80;        server_name  localhost;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {            root   html;            index  index.php index.html index.htm;        }        #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        #        location ~ .php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;        #    include        fastcgi_params;            include         fastcgi.conf;        }        # 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;    #    }    #}    #yi正mjh graduation project config    server {        charset utf-8;        client_max_body_size 128M;                   listen 8080;        server_name www.mjh.com;        root    /var/www/mjhGraduation/web;        index   index.php;        access_log      /var/www/mjhGraduation/access.log main;        error_log       /var/www/mjhGraduation/error.log;        location /{                 # Redirect everything that isn't a real file to index.php                try_files $uri $uri/ /index.php?args;        }        location ~ .php$ {                include fastcgi.conf;                fastcgi_pass 127.0.0.1:9000;                try_files $uri = 404;        }        error_page 404 /404.html;        location ~ /.(ht|svn|git){                deny all;        }    }    #gsh graduation project config    server {        charset utf-8;        client_max_body_size 128M;                   listen 8088;        server_name www.mjh.com;        root    /var/www/gshGraduation/web;        index   index.php;        access_log      /var/www/gshGraduation/access.log main;        error_log       /var/www/gshGraduation/error.log;        location /{                 # Redirect everything that isn't a real file to index.php                try_files $uri $uri/ /index.php?args;        }        location ~ .php$ {                include fastcgi.conf;                fastcgi_pass 127.0.0.1:9000;                try_files $uri = 404;        }        error_page 404 /404.html;        location ~ /.(ht|svn|git){                deny all;        }    }    # 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;    #    }    #}}

相关文章教程推荐:yii教程

以上就是nginx不支持yii怎么办的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/360391.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年11月6日 02:39:04
下一篇 2025年11月6日 02:39:39

相关推荐

发表回复

登录后才能评论
关注微信