Home  >  Q&A  >  body text

macos - How to modify the default access site folder path of Apache for a specified user on Mac

As the title states, I want to modify the default access folder path of Apache under my user (Donny). In other words, modify the path accessed by http://localhost/~Donny/. The current default access path is ~/Website. Can it be changed to another location? How to write the user's configuration file?

给我你的怀抱给我你的怀抱2713 days ago754

reply all(5)I'll reply

  • 大家讲道理

    大家讲道理2017-05-16 17:03:20

    No one answered. .

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 17:03:20

    find . -name http.conf
    vi http.conf Modify the <DocumentRoot> item and specify the path you want

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 17:03:20

    I don’t know if it can solve the problem, I just provide an idea.

    Change host.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 17:03:20

    I am currently using the mac apache environment. The configuration is similar to that of linux. The main problem is that the permissions issue needs to be dealt with. If you are lazy, you can do some work on the user while apache is running

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 17:03:20

    Complete your needs by modifying the http-vhosts.conf file.
    Here is the configuration snippet from that profile on my Mac

    <VirtualHost *:80>
             DocumentRoot "/path" #这里指定你的网站根目录
             ServerName example.com
             ErrorLog "/private/var/log/apache2/sites-error_log"
             CustomLog "/private/var/log/apache2/sites-access_log" common
             <Directory />
                     Options Indexes FollowSymLinks MultiViews
                     AllowOverride All
                     #Order deny,allow
                     #Allow from all
                     Require all granted
             </Directory>
    </VirtualHost>

    By default, the directory of my apache program is in /etc/apache2, and the configuration file is in the extra directory under this directory. There are many configuration files in it. These configuration files are generally under the /etc/apache2 directory. Referenced by the main configuration file httpd.conf.

    You can refer to my configuration snippet to modify your http-vhosts.conf file. After the modification is completed, you need to restart apache.

    In fact, these configurations are the same whether on Mac or Linux. The official apache documentation also provides detailed documentation. As long as you read it patiently, you will find the answer quickly.

    Hope this helps.

    reply
    0
  • Cancelreply