How can I make a public HTML folder in Ubuntu?

前端 未结 3 766
北海茫月
北海茫月 2021-02-03 22:51

Simple question, but for some reason I couldn\'t find the exact answer on Google:

I have a fresh Ubuntu install on Slicehost, and would like to make a public directory i

3条回答
  •  旧时难觅i
    2021-02-03 23:46

    Assuming you've already installed apache, do the following:

    sudo a2enmod userdir
    sudo service apache2 reload
    

    The first command enables the userdir apache mod, which does exactly what you want. The second reloads apache configurations so that it starts using the new configuration.

    To install apache2:

    sudo apt-get install apache2
    

    Of course, you'll also need to make sure that the permissions on your public_html folder allow the www-data user to see the files in there -- 755 usually works well. To do this:

    mkdir ~/public_html
    chmod -R 755 ~/public_html
    

    This will recursively (-R) go through your public_html and set the permissions to 755 (owner rwx, and both group and other r-x, r-x).

提交回复
热议问题