7
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7のapacheでUserdirを有効にする

Last updated at Posted at 2014-10-23
/etc/httpd/conf.d/userdir.conf
+     UserDir enable
+     UserDir public_html

apacheからユーザの/home/owner/public_html/を見れるようにする。

権限修正
mkdir /home/owner/public_html
chmod g+x /home/owner/
chown :apache /home/owner/
httpdリスタート
systemctl restart httpd

http://url/~owner/ でアクセスができることを確認。

なお、特定のVirtualHostのみUserdirを有効にすることができる。

  <VirtualHost *:80>
  
      ServerName default
      DocumentRoot "/srv/default"
      ServerAdmin root@localdomain.com
      CustomLog logs/access.log common
      ErrorLog logs/error.log
  
+     <IfModule mod_userdir.c>
+         UserDir enable
+         UserDir public_html
+     </IfModule>
  
      <Directory /srv/default>
          AllowOverride All
          Require all granted
      </Directory>
  
  </VirtualHost>
7
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?