不废话,直接上过程
sudo vim /private/etc/hosts;
#增加要监控的server_name
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 sayhei.com #这一行我加的
然后修改MAMP的nginx配置
vim /Applications/MAMP/conf/nginx/nginx.conf
server {
listen 80 default_server;
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
root "/Applications/MAMP/htdocs";
access_log /Applications/MAMP/logs/nginx_access.log;
error_log /Applications/MAMP/logs/nginx_error.log debug;
location / {
index index.html index.php;
root /Applications/MAMP/htdocs;
}
...
}
#添加一个server
server {
listen 80;
server_name sayhei.com;
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
root "/Applications/MAMP/htdocs/project/tp5/public";
access_log /Applications/MAMP/logs/nginx_access.log;
error_log /Applications/MAMP/logs/nginx_error.log debug;
location / {
index index.html index.php;
}
...
}
修改root路径,重启nginx,OK。