具体代码如下所示:
rush:PHP;">
# 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;
}
}
}
总结
以上所述是小编给大家介绍的ThinkPHP 在阿里云上的Nginx.config配置实例详解,希望对大家有所帮助。程序员遇到问题都会上(编程之家jb51.cc)查找问题解答方法!如果觉得站点还不错,随手转发给程序员朋友一下!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。