윈도우용이 리눅스용하고 조금 틀린 설정 같아서 새로 올려드립니다.
<참고문서>
http://www.farinspace.com/codeigniter-nginx-rewrite-rules/
<테스트환경>
ngxmp : 18.0
http://dev.naver.com/projects/ngxmp/
ci 2.2.1
설치위치
F:\NGXMP
소스위치
F:\NGXMP\www
<설정파일 첨부>
F:\NGXMP\server\nginx\conf\nginx.conf
<윈도우상 성공화면>
nginx.conf 소스
###########################################
#
# NGXMP 설정 파일
# By totoru ( http://ncafe.kr )
#
###########################################
# 프로세서
# 윈도우에서는 이값을 1로 지정하셔야됩니다.
# 이값은 변경하지 마세요.
worker_processes 1;
# PCRE JIT
pcre_jit on;
events {
# 동시 접속자수 기본값 1024명
# 최대 8192명까지 되도록 컴파일되어있습니다.
# 최대값 8192 이상은 지정하지마세요. 8192이하의 값을 지정하세요.
# 수치가 높을수록 메모리도 그만큼 사용됩니다.
worker_connections 4096;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server_tokens off;
# 타임아웃
keepalive_timeout 75s;
# php 파일 업로드 크기 기본 4096MB 더 큰 파일시 조정하세요.
client_max_body_size 4096m;
# gzip 압축전송(웹페이지 속도가 빨라집니다) 기본값 On
gzip on;
gzip_comp_level 6;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# DDOS
#limit_conn_zone $binary_remote_addr zone=ddos:10m;
#limit_conn ddos 50;
#limit_req_zone $binary_remote_addr zone=phpddos:10m rate=15r/s;
# GeoIP 사용시 주석제거..
#geoip_country F:/NGXMP/server/php/GeoIP.dat;
# index 파일명
index index.html index.htm index.php;
server {
# 포트
listen 80;
# 도메인 호스트 네임
server_name localhost;
# 홈 디렉토리
root F:/NGXMP/www;
index index.php index.html index.htm;
# enforce www (exclude certain subdomains)
# if ($host !~* ^(www|subdomain))
# {
# rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
# }
# enforce NO www
if ($host ~* ^www\.(.*))
{
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# canonicalize codeigniter url end points
# if your default controller is something other than "welcome" you should change the following
if ($request_uri ~* ^(/welcome(/index)?|/index(.php)?)/?$)
{
rewrite ^(.*)$ / permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# removes access to "system" folder, also allows a "System.php" controller
if ($request_uri ~* ^/system)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# catch all
error_page 404 /index.php;
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME F:/NGXMP/www$fastcgi_script_name;
include fastcgi_params;
}
# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}
# SSL 시작
# SSL 서버 사용시 주석 제거
# server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate F:/NGXMP/server/nginx/conf/ssl/localcert.crt;
# ssl_certificate_key F:/NGXMP/server/nginx/conf/ssl/localkey.key;
# ssl_client_certificate F:/NGXMP/server/nginx/conf/ssl/cacert.crt;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# ssl_session_cache shared:SSL:10m;
#
# root F:/NGXMP/www;
#
# # php 설정
# location ~ \.php$ {
# # 해킹될수가있어 try_files $uri =404; 추가함
# try_files $uri =404;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_connect_timeout 300s;
# fastcgi_send_timeout 300s;
# fastcgi_read_timeout 300s;
# fastcgi_buffer_size 128k;
# fastcgi_buffers 8 128k;
# fastcgi_busy_buffers_size 256k;
# fastcgi_temp_file_write_size 256k;
# fastcgi_index index.php;
# fastcgi_intercept_errors on;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param HTTPS on;
# include fastcgi_params;
#limit_req zone=phpddos burst=2;
# }
# }
# SSL 설정 끝
# 가상 호스트 설정파일
# 사용시 아래 #을 제거하신후 F:/NGXMP/server/nginx/conf/virtualhost.conf 에서 셋팅하면됩니다.
#include virtualhost.conf;
}