로그 오류 확인
tail -f /var/log/nginx/error.log
기본설정
user nginx; # 프로세스의 실행되는 권한. 보안상 root를 사용하지 않습니다.
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
upstream docker-server {
server server:8080;
}
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_pass <http://docker-server>;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /socket {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_pass <http://docker-server>;
}
}
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
server_tokens off;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
다른 설정파일 추가후 경로 설정
vi /etc/nginx/conf.d/linux.vm.conf
리다이렉션
server {
listen 80;
server_name nginx.linux.vm ;
location / {
return 301 https://nginx.linux.vm$request_uri;
expires epoch;
}
}
server {
listen 443 ssl http2;
server_name nginx.linux.vm ;
root /usr/share/nginx/linux.vm;
index index.html index.htm;
ssl on;
ssl_certificate "/etc/pki/tls/certs/ca.crt";
ssl_certificate_key "/etc/pki/tls/private/ca.key";
ssl_trusted_certificate "/etc/pki/tls/certs/ca.crt";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers PROFILE=SYSTEM;
ssl_prefer_server_ciphers on;
}
~
'Linux' 카테고리의 다른 글
web was cgi 연동 (0) | 2024.10.25 |
---|---|
nfs 설정법 (0) | 2024.10.25 |
http -> https 적용법 (0) | 2024.10.25 |
web - dns 서버 연동 (0) | 2024.10.25 |
DNS 서버 세팅 (0) | 2024.10.25 |