mac uses apache to build a server

1. Enter sudo apachectl start at the terminal to start the server

2. Enter http://127.0.0.1 in Safari, click OK, and the successful display: It Works!

3. Go to the local file address of the Apache server: /Library/WebServer/Documents

4 Add files to the local server
Put your own files, such as a photo or an html, under this address

5. Enter http://127.0.0.1/test0 in Safari

Basic information about apatch

View apatch version number: sudo apachectl -v
1

Configuration file address: /etc/apache2/httpd.conf

Apatch server host configuration file address: /etc/apache2/extra/httpd-vhosts.conf

.apatch main command:

Start: sudo apachectl start

Stop: sudo apachectl stop
1
2
3
Backup source files: sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.backup

Edit configuration file sudu vi /etc/apache2/httpd.conf

Set the root directory of the server to /Library/WebServer/Documents/
——————————————————
Copyright statement: This article is the original article of CSDN blogger "Guo Dafa." Follow CC 4.0 BY-SA Copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/weixin_45532220/article/details/118272811

Guess you like

Origin blog.csdn.net/qq983985955/article/details/128916196