nginx缺少站点可用目录 [英] nginx missing sites-available directory
问题描述
我在 Centos 6 上安装了 Nginx,我正在尝试设置虚拟主机.我遇到的问题是我似乎找不到 /etc/nginx/sites-available
目录.
I installed Nginx on Centos 6 and I am trying to set up virtual hosts. The problem I am having is that I can't seem to find the /etc/nginx/sites-available
directory.
我需要做些什么来创建它吗?我知道 Nginx 已经启动并运行,因为我可以浏览到它.
Is there something I need to do in order to create it? I know Nginx is up and running because I can browse to it.
推荐答案
好吧,我认为 nginx 本身在其设置中没有这个,因为 Ubuntu 维护的包将其作为模仿 Debian 的 apache 设置的惯例.如果您想模拟相同的设置,您可以自己创建它.
Well, I think nginx by itself doesn't have that in its setup, because the Ubuntu-maintained package does it as a convention to imitate Debian's apache setup. You could create it yourself if you wanted to emulate the same setup.
创建/etc/nginx/sites-available
和/etc/nginx/sites-enabled
,然后编辑http
里面的块/etc/nginx/nginx.conf
并添加这一行
Create /etc/nginx/sites-available
and /etc/nginx/sites-enabled
and then edit the http
block inside /etc/nginx/nginx.conf
and add this line
include /etc/nginx/sites-enabled/*;
当然,所有文件都在 sites-available
中,您可以在 sites-enabled
中为您想要启用的文件创建符号链接.
Of course, all the files will be inside sites-available
, and you'd create a symlink for them inside sites-enabled
for those you want enabled.
这篇关于nginx缺少站点可用目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!