引子
本篇记录学习 nginx 的点滴
主要配置
与 PHP 整合
<code>vim nginx.conf location / { root /var/www/html; index index.html index.php; <span># ThinkPHP hide index.php</span> try_files <span>$uri</span><span>$uri</span>/ /index.php?s=<span>$uri</span>&<span>$args</span>; } location ~ \.php { root /var/www/html; fastcgi_pass <span>127.0</span>.<span>0.1</span>:<span>9000</span>; fastcgi_index index.php; include fastcgi_params; <span>set</span><span>$path_info</span><span>""</span>; <span>set</span><span>$real_script_name</span><span>$fastcgi_script_name</span>; <span>if</span> (<span>$fastcgi_script_name</span> ~ <span>"^(.+?\.php)(/.+)$"</span>) { <span>set</span><span>$real_script_name</span><span>$1</span>; <span>set</span><span>$path_info</span><span>$2</span>; } fastcgi_param SCRIPT_FILENAME <span>$document_root</span><span>$real_script_name</span>; fastcgi_param SCRIPT_NAME <span>$real_script_name</span>; fastcgi_param PATH_INFO <span>$path_info</span>; }</code>
以上就介绍了 Nginx 配置笔记,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。