300x250
반응형
nginx 설치
sudo apt install nginx
설정파일 (sites-available)
ubuntu@ip...:~$ cd /etc/nginx/sites-available/
ubuntu@ip...:/etc/nginx/sites-available$ sudo vi myproject
myproject
server {
listen 80;
server_name 3.35.xxx.xx;
location = /favicon.ico { access_log off; log_not_found off; }
location /static {
alias /home/ubuntu/projects/myproject/pybo/static;
}
location / {
include proxy_params;
proxy_pass http://unix:/tmp/myproject.sock;
}
}
설정파일 적용 (sites-enabled)
#이동
ubuntu@ip...:/etc/nginx/sites-available$ cd ../
ubuntu@ip...:/etc/nginx$ cd sites-enabled/
#기존 적용된 default 링크 삭제
ubuntu@ip...:/etc/nginx/sites-enabled$ ll
total 8
drwxr-xr-x 2 root root 4096 Jun 7 16:57 ./
drwxr-xr-x 8 root root 4096 Jun 7 16:57 ../
lrwxrwxrwx 1 root root 34 Jun 7 16:57 default -> /etc/nginx/sites-available/default
#myproject 링크 생성
ubuntu@ip...:/etc/nginx/sites-enabled$ sudo rm default
ubuntu@ip...:/etc/nginx/sites-enabled$ sudo ln -s /etc/nginx/sites-available/myproject
ubuntu@ip...:/etc/nginx/sites-enabled$ ls
myproject
nginx 재시작
ubuntu@ip...:/etc/nginx/sites-enabled$ sudo systemctl restart nginx
정상 작동여부 확인
ubuntu@ip...:/etc/nginx/sites-enabled$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
브라우저에서 접속시 잘 돌아가는거 확인
300x250
반응형
'IT > 서버' 카테고리의 다른 글
영상 스트리밍 : rtmp와 ffmpeg 그리고 hls (0) | 2021.09.16 |
---|---|
PostgreSQL 세션 신규 연결시 에러 (FATAL: sorry, too many clients already) (0) | 2021.06.14 |
gunicorn 서비스로 등록하기 (0) | 2021.06.07 |
wsgi 서버 (0) | 2021.06.07 |
[점프투플라스크] 303쪽 alias 안될때 (command not found) (0) | 2021.06.07 |