Windows , linux , and mac installation software can all use the graphical interface and install through mouse clicks, but the same as linux , mac can also use terminal commands to install the program, but the configuration of a series of dependencies after installation is very cumbersome, so You can install brew (full name homebrew ) first, and then use brew to install other software.
If an error occurs when Brew installs the program, unless the command of brew install xxx is entered incorrectly at the beginning, there will be instructions on how to correct the error. The configuration file can also be automatically matched. After the installation is complete, the path displayed on the last line is the installation path of the file.
Install brew under Mac : $ ruby -e "$ ( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install ) "
As far as the development environment is concerned, apache and nginx are programs at the same level, mysql is the database, and php is the script language that links the two. Therefore, it is best to install apache and nginx first , and then install php or mysql . When installing, you need to use instructions, add dependencies or compile them into some programs for ease of use, then install apache and nginx first to avoid confusion
Development environment : LAMP ( Linux+Apache+Mysql+Php ) or LNMP ( Linux+Nginx+Mysql+Php )
Closer to home, this dish has been looking for a long time on the Internet when installing apache , but the posts of all the tutorials are all the same, as if they were copied from the same post, and none of the original addresses have been pasted. The original text has been deleted until I finally found it. I wrote a conscience blog and posted the original address. Only then did I find the apache installation method. By the way, I found the method of php multi-version switching . Although apache and php are pre-installed on the mac , some apache scripts are also removed , so Reinstalling it with brew is not useless, and understanding apache 's configuration files in detail can also give you a clearer understanding of apache and the services it provides.
Here is the link to the original text: https://zhuanlan.zhihu.com/p/24614926
However, the other nginx and mysql are much simpler and can be installed directly with one instruction brew install mysql / nginx .
Installation is only the first step. After that, the configuration file is modified in order to make them run normally. Generally, the configuration file is .ini or .conf.default. Generally, the configuration file will be copied first and then modified and copied. The initial version is still a little lower ( sudo , enforcement, etc.) nginx is mainly careful not to duplicate the port with other servers when configuring it, and the other is
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
and
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
(In fact, there are a lot of such documents on the Internet...)
Next is about how to start the two
Apache:
Start: sudo apachectl start
Stop: sudo apachectl stop
Restart: sudo apachectl -k restart
nginx:
First: cd /usr/local/cellar/nginx/1.10.3/bin
This is the installation directory, you know what the bin file means
Then: sudo ./nginx
Determine whether the configuration file is correct: sudo ./nginx -t
Restart: sudo ./nginx -s reload
closure:
" Query nginx main process number: ps -ef|grep nginx ;
Stop normally with sudo kill -QUIT the main process number;
Quickly stop sudo kill -TERM main process number "