因此,我在我的 sites-available 中有一个指向我的配置文件的符号链接,在我的 sites-enabled 文件夹中也有一个指向该文件的符号链接。
[emai@511863-web3 sites-available]$ ls
mysite-staging.conf
[emai@511863-web3 sites-available]$ cd ..
[emai@511863-web3 httpd]$ ls
conf conf.d logs modules run sites-available sites-enabled
[emai@511863-web3 httpd]$ cd sites-enabled/
[emai@511863-web3 sites-enabled]$ ls
mysite-staging.conf
[emai@511863-web3 sites-enabled]$ more mysite-staging.conf
<VirtualHost *:80>
RailsEnv "staging"
RackEnv "staging"
ServerName mysite-staging.nettheory.com
ServerAlias mysite-authorize-staging.nettheory.com
DocumentRoot /usr/local/www/mysite-staging/current/public
ErrorLog logs/mysite-staging/error_log
CustomLog logs/mysite-staging/access_log combined
<Directory /usr/local/www/mysite-staging/current/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
但是,当我检查语法时,Apache 没有检测到任何东西。
[emai@511863-web3 sites-enabled]$ apachectl -S
VirtualHost configuration:
Syntax OK
[emai@511863-web3 sites-enabled]$ /usr/sbin/httpd -S
VirtualHost configuration:
Syntax OK
我重新启动了 apache 并尝试通过浏览器访问我的网站,但它只给我默认的 redhat linux 页面,并且不允许我访问该网站,因为我猜它没有启动。有人知道为什么吗?
答案1
sites-enabled
是 Debian 主义,在 RHEL 中默认不被使用或配置。您创建了该目录吗?
您可以放入您的站点文件/etc/httpd/conf.d/
以使其工作。或者,您可以sites-enabled
通过在底部添加一行来加载配置/etc/httpd/conf/httpd.conf
:
Include /etc/httpd/sites-enabled/*