TIP게시판

제목 제가 사용중인 ci4 nginx 설정입니다.
글쓴이 테러보이 작성시각 2020/01/31 17:49:19
댓글 : 4 추천 : 0 스크랩 : 1 조회수 : 13197   RSS
테러보이
server {
    listen       80;
    server_name  ci.z9n.net ci.o0o.st;
    root   /home/workspace/ci/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php/$args;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

 

 다음글 Xdebug command Line 디버깅 (1)
 이전글 다음달 구하기 (다음달 마지막날 구하기) (2)

댓글

kaido / 2020/01/31 18:44:15 / 추천 0

공유 감사합니다 !

server {
    listen       80;
    server_name  localhost;

    root   /var/www/app/public;
    autoindex on;
    index index.php index.html;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php;
	      location = /index.php {
              fastcgi_pass   php:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
              fastcgi_param  REMOTE_ADDR        $remote_addr;
              fastcgi_param  REMOTE_PORT        $remote_port;
              include        fastcgi_params;
            }
    }

    location ~ \.php$ {
       root   /var/www/app/public;
       fastcgi_pass   php:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_param  REMOTE_ADDR        $remote_addr;
       fastcgi_param  REMOTE_PORT        $remote_port;
       include        fastcgi_params;       
    }
    
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
       deny  all;
    }

저는 이렇게 맞추어서 사용하고있습니다 ㅎㅎ

9000번은 xdebug 용 포트입니다.

 

추가로 rewrite 건들다가 css js image 가 로드가 안되는 경우 예외처리는 해당 설정을 추가하시면 됩니다.

location ~* \.(?:css|js|png|jpg|jpeg)$ {
        expires 1y;
        access_log off;
        add_header Cache-Control "public";
    }

 

끗 !

테러보이 / 2020/01/31 18:50:17 / 추천 0
@kaido
감사합니다 ㅎㅎㅎ
한대승(불의회상) / 2020/02/02 12:01:10 / 추천 0

좋은 정보 공유 감사합니다.

이제 nginx에 관심을 가져봐야겠네요.

테러보이 / 2020/02/03 11:59:57 / 추천 0

@불의회상

전 이제 아파치는 못쓰게되서 ㅋㅋㅋ