nginx下yii的配置
程序员文章站
2022-04-29 21:53:00
...
这是转载文章,
来源:
https://www.yiiframework.com/doc/guide/2.0/zh-cn/start-installation
以下是nginx下的php的 yii2.0 框架的配置文件
server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name mysite.test;
root /path/to/basic/web;
index index.php;
access_log /path/to/basic/log/access.log;
error_log /path/to/basic/log/error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
来源:
https://www.yiiframework.com/doc/guide/2.0/zh-cn/start-installation
以下是nginx下的php的 yii2.0 框架的配置文件
server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name mysite.test;
root /path/to/basic/web;
index index.php;
access_log /path/to/basic/log/access.log;
error_log /path/to/basic/log/error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
推荐阅读
-
windows下配置apache+php+mysql时出现问题的处理方法
-
win7 下搭建sublime的python开发环境的配置方法
-
Win10下免安装版MySQL8.0.16的安装和配置教程图解
-
Nginx服务器上安装并配置PHPMyAdmin的教程
-
Nginx跨域使用字体文件的配置方法
-
nginx php-fpm中启用慢日志配置(用于检测执行较慢的PHP脚本)
-
nginx php-fpm环境中chroot功能的配置使用方法
-
在Debian下配置Python+Django+Nginx+uWSGI+MySQL的教程
-
Nginx负载均衡的4种方案配置实例
-
Nginx下配置301重定向的正确方法例子