這篇文章將為大家詳細講解有關(guān)nginx不支持yii解決方法,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
專業(yè)從事成都做網(wǎng)站、網(wǎng)站制作,高端網(wǎng)站制作設(shè)計,重慶小程序開發(fā)公司,網(wǎng)站推廣的成都做網(wǎng)站的公司。優(yōu)秀技術(shù)團隊竭力真誠服務,采用H5場景定制+CSS3前端渲染技術(shù),成都響應式網(wǎng)站建設(shè)公司,讓網(wǎng)站在手機、平板、PC、微信下都能呈現(xiàn)。建站過程建立專項小組,與您實時在線互動,隨時提供解決方案,暢聊想法和感受。
nginx不支持yii怎么辦?nginx部署yii2的方法
只需要修改nginx.config配置文件內(nèi)容,在里面增加server,并且root寫成index.php文件在的目錄下就可以
還要設(shè)置config/web.php里的cookieValidationKey值,以及一些目錄的訪問權(quán)限需要設(shè)置成777
nginx配置文件內(nèi)容
#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; # } #} }
關(guān)于“nginx不支持yii解決方法”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。