Mac configuration Apache server details

Time:2019-12-28

Configuration purpose

Configure your own server on the Mac to facilitate some of your own networking requests.

Detailed steps:

The first step is to create the sites directory under the home directory as the directory to store subsequent network requests, as shown in the following figure:

Mac configuration Apache server details

Step 2: enter the working directory of terminal switching

$ cd /etc/apache2

Step 3: back up the directory to prevent the failure of recovery after http.conf is broken

$sudo cp httpd.conf httpd.conf.bak

//If you regret it, you can restore it with the following command

$sudo cp httpd.conf.bak httpd.conf

As shown in the figure:
Mac configuration Apache server details

Step 4 edit httpd.conf with VIM

$ sudo vim httpd.conf

Step 5 modify DocumentRoot

Mac configuration Apache server details

Step 6 add an indexes

Mac configuration Apache server details

Step 7: modify PHP to remove “X”

Mac configuration Apache server details

Step 8 save press ESC to exit editing press I

// preservation
&:wq
//Force save
&:wq!

Step 9 switch directory to / etc

//Switch directories
$cd /etc

//Copy php.ini file
$sudo cp php.ini.default php.ini

Step 10 restart Apache

//Restart Apache
$ sudo apachectl -k restart
//Terminate Apache
$sudo apachectl -k stop
//Start Apache
$sudo apachectl -k start

In this step, if the following errors are encountered:

Mac configuration Apache server details

Solve:
Re edit httpd.conf to modify the following

Mac configuration Apache server details

Step 11 finish the interface, open the browser and input localhost

Mac configuration Apache server details

Recommended Today

PHP realizes UnionPay business H5 payment

UnionPay business H5 payment interface document: document address 1: H5 payment interface address: 1: Alipay payment Test address: http://58.247.0.18:29015/v1/netpay/trade/h5-pay Official address: https://api-mop.chinaums.com/ 2: UnionPay payment Test address: http://58.247.0.18:29015/v1/netpay/uac/order Official address: https://api-mop.chinaums.com/ 2: Basic parameters required by the interface The interface uses get parameters. After the interface parameters are directly put into the interface address, the […]