1. nginx.conf 확인
sudo vi /etc/nginx/nginx.conf

include /etc/nginx/sites-enabled/*; 있는지 확인
2. vhost 설정 폴더 확인
/etc/nginx 에 sites-available sites-available 폴더 확인

sudo vi /etc/nginx/sites-available/lore2.vm-ubuntu.com
server {
listen 80;
server_name lore2.vm-ubuntu.com;
root /home/lore2/public_html;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
# PHP 처리설정(에이쒸 아파치가 짱이여)
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
**** root 경로는 알아서 생성하고 ***
*** 권한이나 소유권 에러 날수 있으니 이부분은 알아서 ****
알아서 사용자 생성하고,
useradd -m lore2
알아서 소유권도 주고 ,
sudo chown -R lore2:lore2 /home/lore2
알아서 권한도 주고 ,
sudo chmod -R 755 /home/lore2/
*** ngnix쓰려면 소유권이 www-data 이라는데 안해두 잘된다. 이유는 모름....(아파치가 좋아) ***
심볼링크 설정.... 아따 복잡하다.. 그냥 아파치 처럼 conf.d에다 하면 안되나
sudo ln -s /etc/nginx/sites-available/lore2.vm-ubuntu.com /etc/nginx/sites-enabled/

기본설정 비활성화
sudo unlink /etc/nginx/sites-enabled/default
잘됐나 확인
sudo nginx -t

엔진엑수 재시작
sudo systemctl reload nginx
윈도우 host 파일변경
C:\Windows\System32\drivers\etc\hosts


'리눅스 헛다리 > Ubuntu' 카테고리의 다른 글
우분투24.04 ftp 설정 (0) | 2024.12.15 |
---|---|
우분투 sftp 권한 처리(nginx 루트경로를 /var/www/html/ 인경우 ) (0) | 2024.12.13 |
우분투24.04서버 nginx설치02 [php-fpm설치] (1) | 2024.12.01 |
우분투24.04서버 nginx설치01 (0) | 2024.12.01 |
우분투24.04서버 php설치 (0) | 2024.11.30 |