[SERVER] linux virtualhost 설정.

참고 Link :
https://nouveauframework.org/blog/vhosts-running-multiple-sites-on-a-single-aws-ec2-instance/


aws amazon linux 기준.

1. 우선 원하는 디렉토리 만듬. (default : /var/www/html ) 다른 위치도 됨.

mkdir /var/www/html/원하는 디렉토리 이름.

2. apache(httpd) 설정 추가.

 가. cd /etc/httpd/conf.d  이동
 나. vi vhost.conf   파일 만들기
    1). 기본값 기입 후 저장.

<VirtualHost *:80>

# Leave this alone. This setting tells Apache that
# this vhost should be used as the default if nothing
# more appropriate is available.

ServerName default:80

# REQUIRED. Set this to the directory you want to use for
# your “default” site files.

DocumentRoot /var/www/html

# Optional. Uncomment this and set it to your admin email
# address, if you have one. If there is a server error,
# this is the address that Apache will show to users.

#ServerAdmin you@example.com

# Optional. Uncomment this if you want to specify
# a different error log file than the default. You will
# need to create the error file first.

#ErrorLog /var/www/vhosts/logs/error_log

</VirtualHost>

 -----------------------필수값--------------------
ServerName
ServerAlias (optional)
DocumentRoot
ServerAdmin (optional)
ErrorLog (optional)
<Directory>
---------------------------------------------------

3. sudo service httpd restart         아파치 재시작.

그외 ......
설정 부분에서 필요에 따라 추가적인 설정가능.
여러 vhost 추가 가능.



댓글

이 블로그의 인기 게시물

[문서] excel 체크박스 삭제

[DB] MySQL 백업 / 복원

[WEB] ASP.NET System.NullReferenceException: 개체 참조가 개체의 인스턴스로 설정되지 않았습니다.