[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
자동등록방지 숫자입력

웹개발

번호 제목 글쓴이 날짜 조회수
22 [리눅스] Apache Document Root 권한설정 최고관리자 09-04 1,571
21 [리눅스] CentOS Version 확인하기 최고관리자 09-04 1,408
20 [리눅스] MySQL 최초 접속 및 설정 최고관리자 09-03 1,704
19 [리눅스] MySQL 5.7 보안설정 최고관리자 09-03 1,500
18 [리눅스] RDate로 시간 동기화 하기. 최고관리자 09-03 1,425
17 [리눅스] 기본설치 (Apache , PHP , MySql) 최고관리자 09-03 1,975
16 [공부] 프로그래밍 공부 사이트 최고관리자 09-01 1,357
15 [기능] Mobile 메뉴 최고관리자 09-01 1,322
14 [기능] Mega Menu 최고관리자 09-01 1,368
13 [기능] 상단에서 메뉴높이가 높고 아래로 스크롤하면 메뉴높이가 줄어듦 최고관리자 09-01 1,374
12 [기능] 상단에 메뉴가 보이다가 아래로 스크롤하면 메뉴가 사라지고 상단으로 가면 메뉴가 보임. 최고관리자 09-01 1,293
11 [기능] 메뉴가 안 보이다가 아래로 스크롤하면 메뉴가 생김 최고관리자 09-01 1,398
10 [기능] Icon으로 구성된 수직/수평 메뉴 최고관리자 09-01 1,240
9 [JS] 자바스크립트 {...} [...] 문법 (비구조화 할당/구조분해 할당) 최고관리자 09-01 1,252
8 [기능] 상단의 높이가 큰 메뉴상태에서 아래로 스크롤하면 상단에 높이가 낮은 메뉴가 고정됨 최고관리자 09-01 1,258
7 [Font] Naversoftware 폰트 리스트 최고관리자 09-01 1,323
6 [Web Font] 직접입력해서 폰트를 확인할 수 있는 사이트 최고관리자 09-01 1,312
5 [CSS - font] unicode-range 최고관리자 08-31 1,541
4 [UI 참고] Oven - 회원가입 최고관리자 08-31 1,269
3 타자기체 - 가로 세로 비율이 고정되어 있는 글꼴로 표현 최고관리자 08-08 1,356