ThinkPHP 在阿里云上的nginx.config配置实例详解
具体代码如下所示:
#Formoreinformationonconfiguration,see:
#*OfficialEnglishDocumentation:http://nginx.org/en/docs/
#*OfficialRussianDocumentation:http://nginx.org/ru/docs/
usernginx;
worker_processesauto;
error_log/var/log/nginx/error.log;
pid/run/nginx.pid;
events{
worker_connections1024;
}
http{
log_formatmain'$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.logmain;
sendfileon;
tcp_nopushon;
tcp_nodelayon;
keepalive_timeout65;
types_hash_max_size2048;
include/etc/nginx/mime.types;
default_typeapplication/octet-stream;
#Loadmodularconfigurationfilesfromthe/etc/nginx/conf.ddirectory.
#Seehttp://nginx.org/en/docs/ngx_core_module.html#include
#formoreinformation.
include/etc/nginx/conf.d/*.conf;
server{
listen80default_server;
listen[::]:80default_server;
server_name_;
root/usr/share/nginx/html;
#Loadconfigurationfilesforthedefaultserverblock.
include/etc/nginx/default.d/*.conf;
location/{
#try_files$uri$uri//index.php;
root/usr/share/nginx/html;
indexindex.phpindex.htmlindex.htm;
if(!-e$request_filename){rewrite^(.*)$/index.php?s=$1last;break;}
}
#redirectservererrorpagestothestaticpage/40x.html
#
error_page404/404.html;
location=/40x.html{
}
#redirectservererrorpagestothestaticpage/50x.html
#
error_page500502503504/50x.html;
location=/50x.html{
}
location~\.php${
root/usr/share/nginx/html;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}
location~/\.ht{
denyall;
}
}
}
总结
以上所述是小编给大家介绍的ThinkPHP在阿里云上的nginx.config配置实例详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!