首页 » Web前端 » nginxyiiindexphp技巧_PHP可用的MVC框架thinkphpyiiphalconnginx做事器主机设备

nginxyiiindexphp技巧_PHP可用的MVC框架thinkphpyiiphalconnginx做事器主机设备

访客 2024-11-06 0

扫一扫用手机浏览

文章目录 [+]

配置是WINDOW或LINUX通用的,只须要把ROOT改一下即可:

#root /var/web/website_dirname; #这是LINUX适用

nginxyiiindexphp技巧_PHP可用的MVC框架thinkphpyiiphalconnginx做事器主机设备

root M:/web/website_dirname; #这是WINDOW适用

nginxyiiindexphp技巧_PHP可用的MVC框架thinkphpyiiphalconnginx做事器主机设备
(图片来自网络侵删)

下面是server配置:

server {

listen 80;

server_name www.youweb.com;

#charset koi8-r;

#access_log logs/host.access.log main;

#root /var/web/website_dirname; #这是LINUX适用

root M:/web/website_dirname; #这是WINDOW适用

index index.html index.htm index.php;

location ~ \.(css|js|jpg|jpeg|png|bmp|gif|svg|ttf|woff|woff2|eot|otf|ico|css\.map|min\.map)(.)$ {

break;

}

location / {

#index index.htm index.html index.php;

#访问路径的文件不存在则重写URL转交给PHP框架处理

if (!-e $request_filename) {

rewrite ^/(.)$ /index.php/$1 last;

break;

}

}

location ~ \.php/?.$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

#加载Nginx默认\"大众做事器环境变量\"大众配置

include fastcgi.conf;

#include fastcgi_params;

#设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME做事器环境变量

set $fastcgi_script_name2 $fastcgi_script_name;

if ($fastcgi_script_name ~ \公众^(.+\.php)(/.+)$\公众) {

set $fastcgi_script_name2 $1;

set $path_info $2;

}

fastcgi_param PATH_INFO $path_info;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;

fastcgi_param SCRIPT_NAME $fastcgi_script_name2;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

#error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

location ~ /\.ht {

deny all;

}

}

标签:

相关文章

房山第一探寻历史文化名区的魅力与发展

房山区,位于北京市西南部,历史悠久,文化底蕴深厚。作为北京市的一个重要组成部分,房山区的发展始终与首都的发展紧密相连。房山区积极推...

Web前端 2025-02-18 阅读1 评论0

手机话费开钻代码数字时代的便捷生活

我们的生活越来越离不开手机。手机话费作为手机使用过程中的重要组成部分,其充值方式也在不断创新。手机话费开钻代码应运而生,为用户提供...

Web前端 2025-02-18 阅读1 评论0

探寻专业奥秘如何查询自己专业的代码

计算机科学已成为当今社会不可或缺的一部分。掌握一门专业代码对于个人发展具有重要意义。面对繁杂的学科体系,如何查询自己专业的代码成为...

Web前端 2025-02-18 阅读0 评论0