我在根文件夹上使用xenforo论坛 我使用 Codeigniter 框架添加文件夹 / somefolder / 我该怎么编辑我的nginx coinfig?
server {
listen 80;
server_name wwww.mysite.com mysite.com;
access_log /var/log/nginx/mysite_access.log;
error_log /var/log/nginx/mysite_error.log;
location / {
root /usr/local/www/mysite;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$uri&$args;
}
location /internal_data/ {
internal;
}
location /library/ {
internal;
}
location ~ \.php$ {
fastcgi_pass unix:/var/tmp/fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/local/www/mysite$fastcgi_script_name;
include fastcgi_params;
}
答案 0 :(得分:0)
检查以下配置。假设/usr/local/www/mysite/
为根文件夹。
server {
listen 80;
server_name wwww.mysite.com mysite.com;
access_log /var/log/nginx/mysite_access.log;
error_log /var/log/nginx/mysite_error.log;
location /internal_data/ {
internal;
}
location /library/ {
internal;
}
location /somefolder {
root /usr/local/www/mysite/somefolder;
if (!-e $request_filename) {
rewrite ^/(.*)$ /somefolder/index.php?/$1 last;
break;
}
}
location / {
fastcgi_pass unix:/var/tmp/fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/local/www/mysite$fastcgi_script_name;
include fastcgi_params;
}
}
希望这有帮助。