Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Mac configures the local Apache server

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How does Mac configure the local Apache server? To solve this problem, today the editor summarizes this article on configuring Apache server, hoping to help more friends who want to solve this problem to find a more simple and easy way.

Apache server startup: enter sudo apachectl start at the terminal and enter.

Mac itself installs ssh service, which does not boot automatically by default

Start the sshd service: sudo launchctl load-w / System/Library/LaunchDaemons/ssh.plist

Stop the sshd service: sudo launchctl unload-w / System/Library/LaunchDaemons/ssh.plist

Check whether to launch: sudo launchctl list | grep ssh

If you see the following output, you have successfully started:-0 com.openssh.sshd

Apache Custom configuration

Root path configuration

First, the default root directory for Apache is under "/ Library/WebServer/Documents/".

We can configure the server root to our own folder:

For example: create a folder of "ApacheFIle" in / users/user

Switch to the working directory: cd / etc/apache2

First, back up the file, which only needs to be executed once: sudo cp httpd.conf httpd.conf.bak (the purpose is to use the command to restore the backup when something goes wrong.

Httpd.conf file: sudo cp httpd.conf.bak httpd.conf)

Edit httpd.conf file with vim, Apache configuration file when httpd.conf file: sudo vim httpd.conf

At this time, you need to enter the password to obtain permission. After entering the password, the editing interface of httpd.conf will appear. Press the I key of the keyboard to enter the editing state.

Find DocumentRoot and Directory in the text and replace the latter path with the folder path you just created.

Before modification: # DocumentRoot "/ Library/WebServer/Documents" # modified / users/user/ApacheFileDocumentRoot "/ users/user/ApacheFIle"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report