Home  >  Article  >  Backend Development  >  Start nginx and php on Mac system boot

Start nginx and php on Mac system boot

WBOY
WBOYOriginal
2016-07-29 09:15:47968browse

I won’t go into details about the installation steps of nginx and php. It’s my first time using a MAC system and I don’t know much about it. Of course I’ve also looked at Baidu. Seeing that other people’s articles are not very detailed, I’ll write an article myself.

Step 1:

Enter the /Library/LaunchDaemons/ directory and use vim to create a file named com.nginx.plist. Save and exit. The content of the file is as follows:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.nginx.plist</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/nginx/sbin/nginx</string>  // nginx启动目录
	</array>
	<key>KeepAlive</key>
	<false/>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/usr/local/nginx/logs/error.log</string>  // 错误日志
	<key>StandardOutPath</key>
	<string>/usr/local/nginx/logs/access.log</string>
</dict>
</plist>

Step 2:

Execute the command (add the file to start nginx in the startup project):

launchctl load -w /Library/LaunchDaemons /com.nginx.plist

Executing the command (check whether nginx starts successfully): ps -ef |grep nginx

The startup of PHP is the same as nginx.

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces how to start nginx and php on Mac system, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn