[NginX] Codeigniter를 위한 server config

기본 환경설정 참고

https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/ 


Go API 추가부분은 아래를 참고하였음.

https://wani.kr/posts/2016/07/01/nginx-proxy-settings/ 




vi /etc/nginx/conf.d/www_telepasi_co_kr.conf


//==> 아래에 임의(예> www_telepasi_co_kr.conf)의 conf파일을 생성하고

//아래의 내용을 입력한다.


############## Domain Redirection

server {

        listen  80;

        server_name telepasi.com *.telepasi.com;

 

        return 301 http://www.telepasi.co.kr$request_uri;

}

 

############## Http Configuration

server {

        listen          80;

        root            /telepasi/web/telepasi.com/www;

        index           index.php index.html;

        server_name     telepasi.co.kr *.telepasi.co.kr;

 

        #access_log     /telepasi/web/telepasi.com/nginxLog/telepasi.co.kr.access.log;

        #error_log      /telepasi/web/telepasi.com/nginxLog/telepasi.co.kr.error.log;

 

        ############# For CI

        # set expiration of assets to MAX for caching

        location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {

                expires max;

                log_not_found off;

        }

 

        location / {

                # Check if a file or directory index file exists, else route it to index.php.

                try_files $uri $uri/ /index.php;

        }

 

        # uri가 있는 경우 

        location uri {

                try_files $uri $uri/ /index.html;

        }

 

        # PHP reverse proxy 설정

        location ~* \.php$ {

                fastcgi_pass 127.0.0.1:9000;

                include fastcgi.conf;

        }

 

        ############# For Go API

        location /go/api {

                # 호출형태 http://www.telepasi.co.kr/go/api/ping

                rewrite ^/go/api(/.*)$ $1 break;                # url에서 other 뒤에 있는 URL을 전부 그대로 사용.

                proxy_pass http://www.telepasi.co.kr:8081;      # 8081 port로 Redirection

                proxy_set_header X-Real-IP $remote_addr;        # 실제 접속자의 IP를 X-Real-IP 헤더에 입혀서 전송.

                proxy_redirect off;

        }

}



//수정후

systemctl restart php-fpm.service

systemctl restart nginx



0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기
captcha
자동등록방지 숫자입력

웹개발

번호 제목 글쓴이 날짜 조회수
122 [Dart] Dart 문법 정리 최고관리자 09-09 1,680
121 [Flutter] absorbpointer-and-ignorepointer 최고관리자 09-08 1,034
120 [PHP] 타입선언 최고관리자 08-22 899
119 [PHP] error_level 셋팅과 실제 출력 최고관리자 08-21 981
118 [MySql] 타입지정시 괄호안의 숫자 최고관리자 08-18 1,036
117 [MySql] MySQL 최적의 데이터 타입 선택 방법 최고관리자 08-18 712
116 [MySql] 인덱스 조회시 주의 사항 최고관리자 08-18 751
115 [MySql] NOT NULL과 DEFAULT 를 동시에 쓸 필요가 있는가? 최고관리자 08-18 784
114 [Flutter] Row and Column 최고관리자 08-16 693
113 [Flutter] Linting 설정으로, 흔하게 실수할 수 있는 것을 build 전 방지하기. 최고관리자 08-16 776
112 [PHP] PHP 7.x PHP 8.x에서의 조건문 최고관리자 07-26 727
111 [JS] Webpack을 쓰는 이유 최고관리자 07-24 852
110 [Vue] Vue Router 최고관리자 07-22 735
109 [Vue] Vue.js 기본 원리 최고관리자 07-22 1,246
108 [MySql] 쿼리 결과를 합치는 union vs union all의 차이 최고관리자 07-10 761
107 [Vue] 일반적인 프로젝트의 구조에 대해 알아보자. 최고관리자 06-18 839
106 [JSP] vue등의 스크립트 분석을 위해 %태그 정도는 알자. 최고관리자 06-18 956
105 [MySql] 페이징(paging) 쿼리시 전체개수를 한번에 처리하는 방법 최고관리자 06-14 1,548
104 [MySql] Join vs Sub Query 비교 최고관리자 06-05 971
103 [SQL] SQL Join에 대한 이해 최고관리자 06-05 853