I have cmsplus.dev
under /etc/apache2/sites-available
with the following code,
<VirtualHost *:80>
ServerAdmin master@server.com
ServerName www.cmsplus.dev
ServerAlias cmsplus.dev
DocumentRoot /var/www/cmsplus.dev/public
LogLevel warn
ErrorLog /var/www/cmsplus.dev/log/error.log
CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>
Now when I use sudo /usr/sbin/a2ensite cmsplus.dev
, I am getting the error,
ERROR: Site cmsplus.dev does not exist!
My webserver Apache/2.4.6 (Ubuntu)
How to solve this issue?
asked Dec 15, 2013 at 6:29
Anshad VattapoyilAnshad Vattapoyil
23.1k18 gold badges84 silver badges132 bronze badges
Solved the issue by adding .conf
extension to site configuration files.
Apache a2ensite
results in:
Error! Site Does Not Exist
Problem; If you found the error while trying to enable a site using:
sudo a2ensite example.com
but it returns:
Error: example.com does not exist
a2ensite
is simply a Perl script that only works with filenames ending .conf
Therefore, I have to rename my setting file for example.com
to example.com.conf
as might be achieved as follows:
mv /etc/apache2/sites-available/example.com /etc/apache2/sites-available/example.com.conf
Success
answered Dec 15, 2013 at 6:54
Anshad VattapoyilAnshad Vattapoyil
23.1k18 gold badges84 silver badges132 bronze badges
9
You probably updated your Ubuntu installation and one of the updates included the upgrade of Apache to version 2.4.x
In Apache 2.4.x the vhost configuration files, located in the /etc/apache2/sites-available directory, must have the .conf extension.
Using terminal (mv command), rename all your existing configuration files and add the .conf extension to all of them.
mv /etc/apache2/sites-available/cmsplus.dev /etc/apache2/sites-available/cmsplus.dev.conf
If you get a «Permission denied» error, then add «sudo » in front of your terminal commands.
You do not need to make any other changes to the configuration files.
Enable the vhost(s):
a2ensite cmsplus.dev.conf
And then reload Apache:
service apache2 reload
Your sites should be up and running now.
UPDATE: As mentioned here, a Linux distribution that you installed changed the configuration to Include *.conf only. Therefore it has nothing to do with Apache 2.2 or 2.4
answered Aug 18, 2014 at 10:28
3
There’s another good way, just edit the file apache2.conf
theres a line at the end
IncludeOptional sites-enabled/*.conf
just remove the .conf
at the end, like this
IncludeOptional sites-enabled/*
and restart the server.
(I tried this only in the Ubuntu 13.10, when I updated it.)
answered Apr 29, 2014 at 21:35
GuilhermeGuilherme
1,97022 silver badges23 bronze badges
3
I just had the same problem. I’d say it has nothing to do with the apache.conf.
a2ensite must have changed — line 532 is the line that enforces the .conf suffix:
else {
$dir = 'sites';
$sffx = '.conf';
$reload = 'reload';
}
If you change it to:
else {
$dir = 'sites';
#$sffx = '.conf';
$sffx = '';
$reload = 'reload';
}
…it will work without any suffix.
Of course you wouldn’t want to change the a2ensite script, but changing the conf file’s suffix is the correct way.
It’s probably just a way of enforcing the «.conf»-suffix.
answered Oct 1, 2014 at 10:26
cslottycslotty
1,66620 silver badges28 bronze badges
1
So ..
quickest way is rename site config names ending in «.conf»
mv /etc/apache2/sites-available/mysite /etc/apache2/sites-available/mysite.conf
a2ensite mysite.conf
other notes on previous comments:
-
IncludeOptional wasn’t introduced until apache 2.36 — making change above followed by restart on 2.2 will leave your server down!
-
also, version 2.2 a2ensite can’t be hacked as described
as well, since your sites-available file is actually a configuration file, it should be named that way anyway..
In general do not restart services (webservers are one type of service):
- folks can’t find them if they are not running! Think linux not MS Windows..
Servers can run for many years — live update, reload config, etc.
The cloud doesn’t mean you have to restart to load a configuration file.
-
When changing configuration of a service use «reload» not «restart».
-
restart stops the service then starts service — if there is a any problem in your change to the config, the service will not restart.
-
reload will give an error but the service never shuts down giving you a chance to fix the config error which could only be bad syntax.
debian or ubunto [service-name for this thread is apache2]
service {service-name} {start} {stop} {reload} ..
other os’s left as an excersize for the reader.
Giacomo1968
25.7k11 gold badges71 silver badges101 bronze badges
answered Mar 31, 2015 at 17:50
lil ol melil ol me
891 silver badge1 bronze badge
Worked after I added .conf
to the configuration file
answered Nov 13, 2016 at 4:30
16kb16kb
8799 silver badges17 bronze badges
I realise that’s not the case here but it might help someone.
Double-check you didn’t create the conf file in /etc/apache2/sites-enabled by mistake. You get the same error.
answered Jan 13, 2019 at 6:03
DaveDave
1,3792 gold badges17 silver badges14 bronze badges
3
I have just upgraded the Ubuntu Server version from 12.04 LTS to 14.04 LTS.
Indeed, as said above, the .conf extension to Apache 2.4.x is needed to the websites vhost files that resides on sites-available directory.
Before read this question I did not have a clue what was going on with the server.
Pretty nice solution.
Just summarizing I did the following steps on Terminal:
1) Access sites-enabled folder
$ cd /etc/apache2/sites-enabled
2) Because the command a2dissite will not work with deprecated files (without .conf) remove the old website files that was published
$ sudo rm <my-old-website-without-.conf>
3) Rename the website vhost files changing its extension adding .conf to the end
$ sudo mv /etc/apache2/sites-available/mywebsite /etc/apache2/sites-available/mywebsite.conf
4) Republish the new and correct vhost file
$ sudo a2ensite mywebsite.conf
5) Check the website on browser and have fun!
answered Apr 4, 2017 at 19:44
1
In my case with Ubuntu 14.04.3 and Apache 2.4.7, the problem was that I copied site1.conf to make site2.conf available, and by copying, something happend and I could not a2ensite site2.conf with the error described in thread.
The solution for me, was to rename site2.conf to site2 and then again rename site2 to site2.conf. After that I was able to a2ensite site2.conf.
answered Dec 9, 2015 at 15:14
1
I had the same issue, because of I tried to use absolute path.
sudo a2ensite /etc/apache2/sites-available/test.conf
instead just run
sudo a2ensite test.conf
it will work after
sudo systemctl reload apache2
answered May 31 at 8:07
Bằng RikimaruBằng Rikimaru
1,4602 gold badges24 silver badges50 bronze badges
Try like this..
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin master@server.com
ServerName www.cmsplus.dev
ServerAlias cmsplus.dev
DocumentRoot /var/www/cmsplus.dev/public
LogLevel warn
ErrorLog /var/www/cmsplus.dev/log/error.log
CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>
and add entry in /etc/hosts
127.0.0.1 www.cmsplus.dev
restart apache..
answered Dec 15, 2013 at 6:34
Balaji PerumalBalaji Perumal
8301 gold badge6 silver badges20 bronze badges
3
Introduction
This is an article where the main focus is to discuss an error message. The error message description exist in the title of this article. The error message is ‘ERROR: Site does not exist !’. That error message appear on executing a command to activate a website in Apache Webserver.The Apache Webserver in this context exists in a Ubuntu Linux operating system. Specifically, it is a Linux Ubuntu 18.4 version. Back to the focus on error appearing at the activation step. The activation process itself is actually done by typing a certain command in the command line interface. There are sequence of steps before the execution of the command as follows :
1. Create a file containing a website configuration for Apache Webserver. The content is not the main focus in this article. Just make sure that every line of the configuration is valid. Don’t forget to place it in the correct location. Usually, in Linux Ubuntu 18.04, it is actually exist in /etc/apache2/sites-available.
2. After successfully create the file, just execute the following command pattern :
a2ensite the-file-configuration-name
The execution command using the above command pattern exist as follows :
root@hostname ~# a2ensite 001-site-configuration ERROR: Site 001-site-configuration does not exist! root@hostname ~#
Solving the Problem
1. Solving the above error message is quite simple. Just check whether the file with the name of 001-site-configuration.conf exist in /etc/apache2/sites-available. The above error message output informing that the file with the name 001-site-configuration is not exist. The file with the name 001-site-configuration.conf is actually a specific file to define the site referred in the content of the configuration file. Make sure the file with the name 001-site-configuration.conf exist. Not only the name must be exactly the same but also the extension of the file must be a .conf file. The location of the file itself must also correct. Since it is the Apache Webserver, the file must be exist in the apache folder configuration.
2. After checking all the aspects, including the file name, the location name and also the extension of the file, just re-execute the above command. The following is the actual execution of the above command :
root@hostname sites-available(keystone)# a2ensite 001-site-configuration Enabling site 004-site-configuration. To activate the new configuration, you need to run: systemctl reload apache2 root@hostname sites-available(keystone)# systemctl reload apache2 apache2.service is not active, cannot reload.
The execution of the above command is possible even when the Apache Webserver’s service is off. In order to view the impact of the above command execution just start the Apache Webserver’s service. Access the URL of the website specified in the configuration file in the browser.
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?
Я только что обновил версию Ubuntu Server с 12.04 LTS до 14.04 LTS.
В самом деле, как сказано выше, расширение .conf для Apache 2.4.x необходимо для файлов vhost веб-сайтов, которые находятся в каталоге, доступном на сайтах.
Прежде чем прочитать этот вопрос, я не понял, что происходит с сервером.
Довольно приятное решение.
Просто подведя итоги, я сделал следующие шаги в терминале:
1) Папка с доступом к сайтам с поддержкой
$ cd /etc/apache2/sites-enabled
2) Поскольку команда a2dissite не будет работать с устаревшими файлами (без .conf), удалите старые файлы веб-сайтов, которые были опубликованы
$ sudo rm <my-old-website-without-.conf>
3) Переименуйте файлы vhost веб-сайта, изменив расширение, добавив .conf в конец
$ sudo mv /etc/apache2/sites-available/mywebsite /etc/apache2/sites-available/mywebsite.conf
4) Переиздайте новый и правильный файл vhost
$ sudo a2ensite mywebsite.conf
5) Проверьте сайт в браузере и получайте удовольствие!:)
Я cmsplus.dev
под /etc/apache2/sites-available
на следующий код
<VirtualHost *:80>
ServerAdmin master@server.com
ServerName www.cmsplus.dev
ServerAlias cmsplus.dev
DocumentRoot /var/www/cmsplus.dev/public
LogLevel warn
ErrorLog /var/www/cmsplus.dev/log/error.log
CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>
теперь, когда я использую sudo /usr/sbin/a2ensite cmsplus.dev
, Я получаю ошибку
ERROR: Site cmsplus.dev does not exist!
сервер Apache/2.4.6 (Ubuntu)
как решить эту проблему?
9 ответов
решил проблему, добавив .conf
расширение для файлов конфигурации сайта.
Apache a2ensite
результаты:
ошибка! Сайт Не Существует
проблема; если вы обнаружили ошибку при попытке включить сайт с помощью:
sudo a2ensite mysite.com
но он возвращает:
ошибка: mysite.com не существует
a2ensite
— это просто скрипт perl, который работает только с именами файлов, заканчивающимися .conf
поэтому я должен переименовать файл настроек для mysite.com
to mysite.com.conf
как может быть достигнуто следующим образом:
mv /etc/apache2/sites-available/mysite.com /etc/apache2/sites-available/mysite.com.conf
успехов
вы, вероятно, обновили свою установку Ubuntu, и одно из обновлений включало обновление Apache до версии 2.4.x
В Apache 2.4.x файлы конфигурации vhost, расположенные в каталоге/etc/apache2 / sites-available, должны иметь .расширением conf.
используя terminal (команда mv), переименуйте все существующие файлы конфигурации и добавьте .расширение conf для всех из них.
mv /etc/apache2/sites-available/cmsplus.dev /etc/apache2/sites-available/cmsplus.dev.conf
Если вы получаете ошибку «отказано в разрешении», добавьте » sudo » перед вашими терминальными командами.
вам не нужно делать какие-либо другие изменения в файлах конфигурации.
включить vhost (ы):
a2ensite cmsplus.dev.conf
а затем перезагрузите Apache:
service apache2 reload
Теперь ваши сайты должны быть запущены.
обновление: как уже упоминалось здесь, дистрибутив Linux, который вы установили, изменил конфигурацию, чтобы включить *.только конф. Поэтому он не имеет ничего общего с Apache 2.2 или 2.4
есть еще один хороший способ, просто отредактируйте файл apache2.conf
в конце есть строка
IncludeOptional сайты-включено/*.conf
просто удалить .conf
в конце, вот так
IncludeOptional сайты-включено/*
и перезапустить сервер.
(Я пробовал это только в Ubuntu 13.10, когда я обновил его.)
у меня была та же проблема. Я бы сказал, что это не имеет ничего общего с Apache.conf.
a2ensite должен быть изменен-строка 532-это строка, которая обеспечивает выполнение .суффикс конфы:
else {
$dir = 'sites';
$sffx = '.conf';
$reload = 'reload';
}
Если вы измените его на:
else {
$dir = 'sites';
#$sffx = '.conf';
$sffx = '';
$reload = 'reload';
}
…он будет работать без суффикса.
конечно, вы не хотели бы изменять сценарий a2ensite, но изменение суффикса файла conf является правильным способом.
это, вероятно, просто способ обеспечения соблюдения «.конф»-суффикс.
Так ..
самый быстрый способ-переименовать имена конфигурации сайта, заканчивающиеся на «.conf»
mv /etc/apache2/sites-available/mysite /etc/apache2/sites-available/mysite.conf
a2ensite mysite.conf
другие примечания к предыдущим комментариям:
-
IncludeOptional не был введен до apache 2.36-внесение изменений выше с последующим перезапуском на 2.2 оставит ваш сервер вниз!
-
кроме того, версия 2.2 a2ensite не может быть взломан, как описано
а также, так как ваш сайт-доступный файл на самом деле является конфигурацией файл, он должен быть назван так в любом случае..
В общем не перезапустить службы (веб-серверы-это один из видов услуг):
- люди не могут найти их, если они не работают! Думаю, linux не MS Windows..
серверы могут работать в течение многих лет-live update, reload config и т. д.
облако не означает, что вы должны перезагрузить, чтобы загрузить файл конфигурации.
-
при изменении конфигурация службы использует «перезагрузку», а не»перезапуск».
-
restart останавливает службу, затем запускает службу — если есть какие-либо проблемы в изменении конфигурации, служба не будет перезагрузка.
-
перезагрузка даст ошибку, но служба никогда не выключается, давая вам возможность исправить ошибку конфигурации, которая может быть только плохим синтаксисом.
debian или ubunto [имя службы для этого потока помощью apache2]
service {service-name} {start} {stop} {reload} ..
другие ОС оставлены как выдержка для читателя.
работала после того, как я добавил .conf
в конфигурационный файл
в моем случае с Ubuntu 14.04.3 и Apache 2.4.7 проблема заключалась в том, что я скопировал site1.conf, чтобы сделать site2.conf доступен, и путем копирования, что-то произошло, и я не мог a2ensite site2.conf с ошибкой, описанной в потоке.
решением для меня было переименовать site2.conf в site2, а затем снова переименуйте site2 в site2.conf. После этого я смог a2ensite site2.conf.
Я только что обновил версию сервера Ubuntu с 12.04 LTS до 14.04 LTS.
действительно, как сказано выше,.расширением conf для Apache 2.4.x необходим для веб-сайтов vhost файлов, которые находятся на сайтах-доступном каталоге.
прежде чем читать этот вопрос, я понятия не имел, что происходит с сервером.
очень хорошее решение.
просто суммируя, я сделал следующие шаги на терминале:
1) доступ к сайтам-включен папка
$ cd /etc/apache2/sites-enabled
2), потому что команда a2dissite не будет работать с устаревшими файлами (без .conf) удалите старые файлы веб-сайта, которые были опубликованы
$ sudo rm <my-old-website-without-.conf>
3) переименовать веб-сайт vhost файлов, изменив его расширение добавления .conf до конца
$ sudo mv /etc/apache2/sites-available/mywebsite /etc/apache2/sites-available/mywebsite.conf
4) переиздать новый и правильный файл vhost
$ sudo a2ensite mywebsite.conf
5) проверяем сайт в браузере и получайте удовольствие!
1
автор: Alexandre Ribeiro
попробуйте вот так..
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin master@server.com
ServerName www.cmsplus.dev
ServerAlias cmsplus.dev
DocumentRoot /var/www/cmsplus.dev/public
LogLevel warn
ErrorLog /var/www/cmsplus.dev/log/error.log
CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>
и добавить запись в /etc/hosts на
127.0.0.1 www.cmsplus.dev
перезапустить apache..