한개의 서버에 두개의 홈페이지를 운영하기 위한 서버 세팅
CMS/프레임워크 | Rhymix 1.9 |
---|---|
개발 언어 | PHP 7.2 |
이런 질문을 라이믹스 관련 사이트에 올려도 될지 모르겠습니다. 제가 딱히 아는 곳이 없어서 이곳에 질문드립니다.
한개의 서버를 가지고 있습니다.
거기에 이미 하나의 홈페이지를 운영하고 있고 하나를 추가하고 싶어서 도메인을 등록했고.
네임서버 설정을 했습니다.
예로.. 기존에 운영중인 첫번째 도메인은 홈페이지.com
새로 등록한 두번째 도메인은 우리집.com 입니다.
그리고 서버에 폴더를 만들었습니다.
이미 운영중인 첫번째는 /home/홈페이지/public_html/
새로 만든 두번째는 /home/우리집/public_html/
public_html 폴더안에 Index.php가 있습니다.
그런 다음 /etc/httpd/conf/httpd.conf
파일을 찾아서
<VirtualHost 118.219.255.160:80>
DocumentRoot /home/홈페이지/public_html
ServerName 홈페이지.com
ServerAlias www.홈페이지.com
</VirtualHost>
<VirtualHost 118.219.255.160:80>
DocumentRoot /home/우리집/public_html
ServerName 우리집.com
ServerAlias www.우리집.com
</VirtualHost>
이렇게 설정했는데...
기존에 운영하던 홈페이지.com은 현재 잘되고 있고 우리집.com이 새로 만든 도메인인데...
우리집.com을 입력하고 들어가면 홈페이지.com이 뜨네요.
이게 제가 뭔가를 잘못한건가요? 구글링 해보니까 httpd.conf 파일에 저렇게 설정하라고 되어있던데요.
추가로 더 해줘야 할 일이 있을까요?
댓글 7
그래서 httpd.conf 파일을 열어서 찾아보니 리다이렉트를 하는 것은 안보이고
비슷한걸 찾아보니 ..
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName 홈페이지.com:80
#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName off
이렇게 되어 있네요. 이게 리다이렉트를 해버리는건지.. 그래서 useCanonicaName을 off로 해야하는지
servername 을 118.219.255.160:80 이렇게 바꿔야 할지 이게 문제네요. 또는 전혀 상관없는건지 ㅠㅠ
#NameVirtualHost 118.219.255.160:80
<VirtualHost 118.219.255.160:80>
DocumentRoot /home/홈페이지/public_html
ServerName 홈페이지.com
ServerAlias www.홈페이지.com
</VirtualHost>
<VirtualHost 118.219.255.160:80>
DocumentRoot /home/우리집/public_html
ServerName 우리집.com
ServerAlias www.우리집.com
</VirtualHost>
맨위에 주석처리된 NamevirtualHost를 풀어줘야 했던것이었네요. 제가 소스를 어설프게 올리고 질문을 드려서 람보님도 답변을 제대로 해주실 수 없었던 것이었습니다. 무지에서 오는 실수죠.
이렇게 httpd.conf를 고쳐서 올리고
ssh로 접속해서 /ets/init.d/httpd graceful 로 처리해서 해결했습니다.
이제 룸을 만들었으니 순정 라이믹스를 인스톨해보려 합니다.
전에는 XE에서 업그레이드 했는데 순정을 인스톨하면 뭐가 다를지 한번 봐야 겠네요.