Article directory
MacOS comes with Apatch server. So I choose Apatch server to build here
1. Start the server
- Enter http://127.0.0.1/ in Safari. If it works on the page, it means the access is successful.
- Start the server
$ sudo apachectl start
- Restart
$ sudo apachectl restart
- closure
$ sudo apachectl stop
- Apache server file address:
/libary/webserver/documents/
2. Add files to local service
-
Prepare an html file
-
Add to the address of the Apache server
-
Enter http://127.0.0.1/test in Safari to see the saved image
3. Access the local server from your mobile phone/other computers
1. Find the IP address of this machine: Open Settings-Network, you can see your IP
Enter http://192.168.9.109 in this machine's Safari to access the same effect as http://127.0.0.1
2. When testing on mobile phones and other computers, you must ensure that the mobile phone and other computers are in the same LAN as this machine
. Enter http://192.168.9.109/test in Safari to access successfully.