我想在mamp上安装vhost,同时使用nginx而不是默认的apache服务器。
我浏览了堆栈溢出和web,但我所能找到的要么是纯的nginx (谈到默认情况下未在mamp上创建的sites-available文件夹),要么是使用apache的vhost和mamp上的nginx。
我确实成功地切换到了nginx,但是我现在看到的只有403个错误(当我回到apache服务器时,我的所有vhost都在工作)。我确实在我的主机文件中添加了行,但我无法使vhost工作。这是我的MAMP/conf/nginx/nginx.conf
http {
...
server {
...
location / {
index index.html index.php;
}
location my-vhost-name.com {
root /Users/myName/Document/projectParentFolder/projectFolder;
index index.html index.php;
}
}
}当我访问我的-vhost-name.com时,我收到了来自nginx的403条错误消息。
谢谢你的帮助。
发布于 2019-12-02 19:03:40
sites-enabled文件夹。MAMP/conf/nginx/sites-enabled中为站点MAMP/conf/nginx/sites-enabled添加了一个配置文件MAMP/conf/nginx/sites-enabled/example.com中添加了配置vars:
服务器{ charset utf-8;client_max_body_size 128 m;发送文件关闭;侦听80;server_name example.com;根/应用程序/MAMP/htdocs/example.com/;索引index.php;位置/{#将不是真正文件的所有内容重定向到index.php try_files $uri $uri/ /index.php$is_args$args;} location ~ .php$ { try_files $uri =404;fastcgi_pass fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;包含fastcgi_params;}(MAMP/conf/nginx/nginx.conf)的末尾,我将sites-enabled文件夹中的所有信任连接起来:
包括启用的站点/*;}https://stackoverflow.com/questions/53359180
复制相似问题