728x90
반응형
1. 먼저 업데이트를 실행 후 nginx를 설치해준다.
$sudo apt update
$sudo apt install nginx
2. 방화벽을 설정해준다.
$sudo ufw allow 'Nginx Full'
$sudo ufw status
3. 설정 파일을 확인해준다.
$vi /etc/nginx/sites-available/default
https 설정이 없는 경우 나머지를 다 지우고 proxy 할 포트와 설정만 해준다.
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/html;
# Add index.php to the list if you are using PHP
#index index.html index.htm index.nginx-debian.html;
#server_name _;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
4. nginx 상태를 확인
$sudo nginx -t
5. nginx 다시 시작
$sudo systemctl restart nginx
728x90
반응형
'Others' 카테고리의 다른 글
CentOS, Ubuntu netstat 설치 방법 (0) | 2022.03.15 |
---|---|
Others | 개인정보처리방침 만들기 (개인정보보호법) (0) | 2022.02.24 |
Others | postman (0) | 2021.09.29 |
whatch error 해결법 (0) | 2021.08.31 |
App-Backend 데이터 전송 (0) | 2021.08.31 |