nginx 세팅

Ihwan Shin·2024년 12월 3일

WEB

목록 보기
4/5

/etc/nginx/sites-available

해당 폴더 하위에 moo.api 파일 생성( 다른이름의 파일 복수 생성 가능 )

server socket은 uwsgi에서 설정한 socket경로로 지정해야한다!

upstream moo {
     server unix:///tmp/sock.moo.api; # for a file socket
}

server {
        listen         80;
        server_name    52.79.139.214;
	root /home/ubuntu/backend/api;

        location ~* \.(php|ini|sql|conf|bak)$ {
            return 403;
        }

   	location / {
		add_header Cache-Control 'no-cache';
		uwsgi_pass  moo;
		include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
    	}

	location /static/ {
	    alias /home/ubuntu/backend/api/static/;
	}

	location /files/ {
	    alias /home/ubuntu/backend/api/files/;
	}

}

/etc/nginx/sites-enabled

sites-available폴더에서 생성한 파일을 심볼릭 링크를 통해 해당 폴더에 생성해준다

profile
Backend Engineer 💻 (since. 21/07/01)

0개의 댓글