2013-06-03 1 views
0

저는/var/www에 하나의 CodeIgniter 프로젝트가 있습니다. 이 프로젝트를 proj라고 부를 것입니다. 그래서/var/www에 많은 수의 파일이 있고/var/www/proj에 CodeIgniter 프로젝트가 있습니다. 나는 이것을 지원할 Nginx 설정이 절실히 필요하다. 가상 호스트를해야할까요? 예 : /var/www/somewebsite.com/ 및 /var/www/proj.somewebsite.com/. 이 작업을 지원하는 Nginx + CodeIgniter 구성을 제공 할 수 있습니까?CodeIgniter + Nginx +/var/www의 기타 파일

저는 현재 도메인을 사용하고 있지 않습니다. 나는 VPS를 사용하고있다.

감사합니다.

답변

0

예. 가상 호스트를 사용해야하거나 다른 포트를 듣기 위해 서버를 생성해야합니다. localhost/myporject1/localhost2/myproject2과 같은 말을하지 않는다면? 다음 서버를 가리 키도록 바로 설치가 /var/www 뿌리와 CI

server { 
     listen 80; 
     server_name localhost; 
     root /var/www/; 


     location ~ /\. { 
       deny all; 
     } 

     #you codigniter project 
     location /yourcodigniterproject { 
       index index.html index.php; 
       try_files /cache$uri @web; 

     } 
     #your other project (if usign php replicate the top with difrent directives) 
     location /yourotherproject { 
       index index.html index.php; 
       try_files /cache$uri $uri 

     } 

     location @web { 
       client_max_body_size 10M; 
       expires 0; 
       fastcgi_pass unix:/var/run/php5-fpm.sock; 
       include /etc/nginx/fastcgi_params; 
       fastcgi_index index.php; 
       fastcgi_param SCRIPT_FILENAME /var/www/yourcodigniterproject/index.php; 
       fastcgi_param PATH_INFO $fastcgi_script_name; 
     } 
} 

에 대한 FastCGI를에 경로를 조정하지만 말했듯이, 유지 관리가 훨씬 쉬워 가상 호스트를 만들 수 있습니다. 각각에 대해 sites-available에 항목을 작성하고 (사용자가 ln -sin 사이트 사용 가능으로 설정 함)

그런 구성이 있습니다. 하나의 가상 서버에는 사이트 코드 지정자 설정이 있고, 다른 하나는 일반 정적 웹 사이트이고, 하나는 phpmyadmin 등입니다.