티스토리 뷰

Linux

nginx conf 설정

CHOMAN 2019. 5. 17. 09:28

nginx 버전 정보 감추기

http {
    server_tokens off;
}

vhost 설정 위한 디렉토리 생성 및 지정

http {
include sites-enabled/*;
}

include /etc/nginx/conf.d/*.conf; 이 디렉토리 안에 넣는것과 차이점?

아이피 차단

server {
    allow 192.168.0.0/24;
    deny all;
}

192.168.0.0/24 아이피 대역을 제외하고 차단

디렉토리 차단

location ~ /(inc|local)/.* {
    deny all;
    return 404;
}

설정된 도메인 이외 차단

server {
listen 80 default;
server_name _;
location / {
          deny all;
          return 406;
}
}

도메인 리다이렉트

server {
listen 80;
server_name 도메인;
location / {
        return 301 http://리다이렉트할도메인$request_uri;
    }
}

php-fpm 연동 설정

location ~ \.(ph(p[345]?|t|tml|ps)|html?|inc)$ {
    fastcgi_pass unix:/var/run/php-fpm/www.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

'Linux' 카테고리의 다른 글

ntp pool project  (0) 2019.06.05
ntp (time.google.com)  (0) 2019.05.28
nginx - php-fpm 연동  (0) 2019.05.16
telnet 통신 테스트  (0) 2019.04.02
gitlab 설치  (0) 2019.03.22
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함