Ubuntu: public_html 설정

DoHn·2024년 12월 8일

Linux Server Settings

목록 보기
5/5

public_html 설정

1) User의 Home 폴더에 자동으로 public_html 폴더 생성

adduser을 했을 때 자동으로 public_html이 생성되도록 해야한다. /etc/skel 디렉토리는 리눅스 운영체제에서 새로운 사용자를 생성하였을 경우, 새 사용자를 위한 기본 폴더를 참고하는 디렉토리이다.

$ mkdir /etc/skel/public_html
$ vim /etc/skel/public_html/index.html

index.html에는 아무 내용이나 적어주면 된다.

<html>
	<head><title>This is cslinux2</title></head>
	<body><p>hello world</p></body>
</html>

아마 위 작업까지 마친 후에도 안된다면 아래 명령어를 차례대로 실행해주면 된다.

그래도 안된다 하면 아래 방법을 시도해보자.

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/userdir.conf userdir.conf
$ sudo ln -s ../mods-available/userdir.load userdir.load
$ sudo service apache2 restart

3) home 디렉토리 접근 권한 설정

$ sudo vim /etc/apache2/apache2.conf

<Directory /home>
		Options Indexes FollowSymLinks
		AllowOverride None
		Require all granted
</Directory>

이제 http://mydomain/~id로 들어가주면 성공적으로 뜨는 모습을 확인할 수 있다.

profile
DoHn's dev log

0개의 댓글