大网数据广告活动
服务器运维问答

Why does a2ensite give me the error "site does not exist"

· 52CE 我爱测

I initially thought I had this problem: https://stackoverflow.com/questions/28572629/a2ensite-site-does-not-exist-error-even-with-conf-file But that did not help me. I cd here: /etc/apache2/sites-enabled I know the path to a2ensi…

问题原文

原帖链接 · lorm · CC BY-SA 3.0

I initially thought I had this problem:

https://stackoverflow.com/questions/28572629/a2ensite-site-does-not-exist-error-even-with-conf-file

But that did not help me.

I cd here:

  /etc/apache2/sites-enabled

I know the path to a2ensite:

  which a2ensite
  /usr/sbin/a2ensite

And I tested the configuration files with this:

  apachectl configtest

I get:

  Syntax OK

I have this file:

  ralph.stagingv2.example.conf

which starts with:

  ServerName ralph.stagingv2.example.com
  DocumentRoot "/home/ralph/example/current/web"
  DirectoryIndex index.php

I created the DocumentRoot with:

  mkdir -p /home/ralph/example/current/web

And I changed permissions to the user we use on AWS:

  chown -R ubuntu /home/ralph/
  chgrp -R www-data /home/ralph/

but when I do:

  a2ensite ralph.stagingv2.example

I get:

  ERROR: Site ralph.stagingv2.example does not exist!

What did I miss?

已采纳解答

原帖链接 · Colt · CC BY-SA 4.0

a2ensite is a script that creates a sybolic link in /etc/apache2/sites-enabled pointing to a .conf file in /etc/apache2/sites-available.

In order to work, your .conf file must be in the "sites-available" directory, i.e.

 /etc/apache2/sites-available/ralph.stagingv2.example.conf

You should NOT actually "place" ANY configuration file in the /etc/apache2/sites-enabled directory.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。