티스토리 뷰

일단 호스트 관련 파일이 /etc/nginx/conf.d/ 폴더 안에 있다..


nginx를 설치하면 위 폴더 안에 default.conf란 파일이 있을것이다.


이걸 복사해서 호스트명 파일로 변경한다


sudo cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/example.conf


파일 복사 후에 


sudo vi /etc/nginx/conf.d/example.conf


데이터로 열어서 


아래와 같이 변경한다..


변경하고나면 당연히 재시작


sudo systemctl restart nginx


server { listen 80; server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { listen 80 default_server; server_name *.example.com example.com; root /var/www/example; index index.html index.php; charset utf-8; access_log /var/log/nginx/example-access.log main; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # deny access to .htaccess files, if Apache's document root concurs with nginx's one # location ~ /\.ht { deny all; } }

참고 : https://wiki.mooo.org/w/Nginx_%EA%B0%80%EC%83%81_%ED%98%B8%EC%8A%A4%ED%8A%B8_%EC%84%A4%EC%A0%95



댓글