ThinkPHP 在阿里云上的nginx.config配置实例详解
发布:smiling 来源: PHP粉丝网 添加日期:2021-08-11 14:17:22 浏览: 评论:0
这篇文章主要介绍了ThinkPHP 在阿里云上的nginx.config配置实例详解,需要的朋友可以参考下,具体代码如下所示:
- # For more information on configuration, see:
- # * Official English Documentation: http://nginx.org/en/docs/
- # * Official Russian Documentation: http://nginx.org/ru/docs/
- user nginx;
- worker_processes auto;
- error_log /var/log/nginx/error.log;
- pid /run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- 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 /var/log/nginx/access.log main;
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
- keepalive_timeout 65;
- types_hash_max_size 2048;
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- # Load modular configuration files from the /etc/nginx/conf.d directory.
- # See http://nginx.org/en/docs/ngx_core_module.html#include
- # for more information.
- include /etc/nginx/conf.d/*.conf;
- server {
- listen 80 default_server;
- listen [::]:80 default_server;
- server_name _;
- root /usr/share/nginx/html;
- # Load configuration files for the default server block.
- include /etc/nginx/default.d/*.conf;
- location / {
- #try_files $uri $uri/ /index.php;
- root /usr/share/nginx/html;
- index index.php index.html index.htm;
- if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; }
- }
- # redirect server error pages to the static page /40x.html
- #
- error_page 404 /404.html;
- location = /40x.html {
- }
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- }
- location ~ \.php$ {
- root /usr/share/nginx/html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location ~ /\.ht {
- deny all;
- }
- }
- }
Tags: nginx config
相关文章
- ·nginx下使用ThinkPHP框架rewrite以及二级目录问题(2014-04-12)
- ·完美解决 nginx ThinkPHP .conf配置 404 Not Found报错等(2014-11-20)
- ·thinkPHP5运行在nginx上的配置方法详解(2020-03-22)
- ·在Nginx上部署ThinkPHP项目教程(2021-05-09)
- ·nginx+thinkphp下解决不支持pathinfo模式(2021-06-06)
- ·解决thinkPHP 5 nginx 部署时,只跳转首页的问题(2022-01-05)
- ·解决tp5在nginx下修改配置访问的问题(2022-01-05)
- ·thinkphp 完整配置config.php(2014-04-19)
- ·TP config.php改变之后(2014-04-19)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)