SW/APM
우분투 (Ubuntu) 22.04 nginx yum 설치 및 virtual host 설정
bigju
2023. 8. 22. 15:40
1. 업데이트 및 Nginx 설치
sudo apt update -y // 업데이트
sudo apt install nginx -y //niginx 설치
systemctl status nginx // nginx 상태확인
2. Nginx 시작 및 확인
systemctl start nginx // nginx 시작
netstat -tnlp // 포트 체크
3. Niginx 설치 확인
http://IP
4. Nginx Virtual Host 설정
cd /etc/nginx/sites-enabled // 경로 이동
vi domain.co.kr // 연결 도메인 폴더 생성
-> ex) vi bigju.co.kr
5. Virtual Host 작성 (bigju.co.kr 폴더)
server {
listen 80;
listen [::]:80;
root /home/bigju/public_html; // 경로 설정
index index.php index.html index.htm index.nginx-debian.html;
server_name bigju.co.kr; // 도메인 주소
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-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;
#}
}
}
6. Virtual Host 연결확인
http://IP
Big Ju