CI 묻고 답하기

제목 nginx 와 CI 연동중 403 error
글쓴이 다다닷 작성시각 2014/05/14 14:48:28
댓글 : 8 추천 : 0 스크랩 : 0 조회수 : 24656   RSS
안녕하세요.
현재 win7에 nginx 를 설치해서 CI연동중에있는데

apache 서버를 사용해서 ci프로젝트를 htdocs 디렉토리 밑에 넣어두고

localhost/ci/test 
라고 호출하면 정상 호출이 되는 상황인데

apache 를 down 시키고 nginx 를 구동해서 위와 같이 

호출시에는 

404 Not Found / nginx/1.6.0 이라는 페이지를 띄우네요.

nginx conf 파일을 수정도 해봤는데..


--- 현재 기본 conf 내용입니다.


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
    

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
    
    
    location / {
        root   html;
        index  index.html index.htm;
           
        }
 
        location ~ \.php$ {
            return 444;
        }
 
    
        #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;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

ci 내 .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci/index.php/$1 [L]

이내용이며, application 내 .htaccess는

allow from all

입니다.

지식공유좀 부탁드릴게요..
 다음글 <body> 다음에 "... (4)
 이전글 초보자 질문드립니다. (4)

댓글

한대승(불의회상) / 2014/05/14 15:27:37 / 추천 0
아래 URL을 확인 하세요.

http://wiki.nginx.org/Codeigniter
다다닷 / 2014/05/14 15:30:29 / 추천 0
@한대승 해당 URL을 따라.. 모두 설정해봤지만 여전히 증상이 똑같아서.. 여기에 문의 남겼습니다. 몇시간째 삽질중이네요.
Artz / 2014/05/14 15:38:10 / 추천 0
1. index 파일이 존재하는 root 설정 오류
2. nginx와 php의 연동 누락

이 2가지 중 하나로 의심되는군요.
 
letsgolee / 2014/05/14 16:05:20 / 추천 0
nginx를 써본 적이 없어 명확히 말하기는 어렵지만 server 의 root가 없네요?
다다닷 / 2014/05/14 16:05:49 / 추천 0
@Artz index 파일은 C:\nginx-1.6.0\nginx-1.6.0\html 내에 index.html , 50x.html 있구요. 
php 연동 확인을 위해서 test.php 에 test라고 echo를 찍어서 확인했습니다..
다다닷 / 2014/05/14 16:07:04 / 추천 0
@letsgolee nginx의 경우 root 디렉토리는  location / { root html; }  로 지정됩니다.
한대승(불의회상) / 2014/05/14 16:34:36 / 추천 0
nginx는 PHP를 외부 모듈에 외부 모듈에 의존했던걸로 기억하는데요.
어떤식으로 하셨는지 궁금하네요.
linux에서만 연동해서 windows는 도움이 크게 못될것같네요.

http://stackoverflow.com/questions/4539670/php-fpm-for-windows
앤드그리고 / 2014/05/14 18:30:26 / 추천 0
server {
    server_name localhost;

    root /var/www;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php;
    }
   
    location ~* \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
}
제가 사용하고 있는 설정파일 중 일부분입니다.
ubuntu + nginx + php-fpm 으로 운영하고 있습니다.

올려주신 설정파일만 보면 index.php 를 처리 하는 부분이 안보이는데,
이 부분을 확인 하셔야 할 듯 합니다.