I have an Apache 2 on Debian and am a beginner (newbie).
When accessing to my webserver in the web brower, I get the Apache default welcome page :
Instead of this page (located in var/www/html), I try to make my real website displayed (var/www/mywebsite.com/). Below is the tree on my server :
---- etc
-------- apache2
------------ sites-enabled
---------------- mywebsite.com.vhost -> etc/apache2/sites-available/mywebsite.com.vhost
------------ sites-available
---------------- mywebsite.com.vhost
---- var
-------- www
------------ mywebsite.com
---------------- web
-------------------- css/
-------------------- js/
-------------------- img/
-------------------- error/
-------------------- index.html
-------------------- robots.txt
My .vhost file is well configurated :
AllowOverride None
Require all denied
DocumentRoot /var/www/mywebsite.com
ServerName mywebsite.com
ServerAlias www.mywebsite.com
ServerAdmin webmaster@mywebsite.com
ErrorLog /var/log/ispconfig/httpd/mywebsite.com/error.log
Alias /error/ "/var/www/mywebsite.com/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
<Directory /var/www/mywebsite.com/web>
# Clear PHP settings of this website
<FilesMatch ".+.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +FollowSymLinks
AllowOverride All
Require all granted.
</Directory>
.. and I made a restart Apache. No success ! The Apache default page is still here. What am I missing ?
Apache 2.4 на debian 8, добавлен виртуальный хост, при его открытии по доменному имени на localhost открывается без проблем, при попытке открыть с внешнего ip по доменному имени открывается apache default page, в hosts внешний ip добавлен, права на папку /var/www/example.com выставлены на www-data, в чем может быть причина?
-
Вопрос заданболее трёх лет назад
-
1865 просмотров
I have an Ubuntu 14.10 computer that is used for local website testing, it is not serving to the internet. On it, I have seven websites set up. However, when I access two of the seven, I get the Apache2 Ubuntu Default Page
instead of my own index page.
As far as I can tell, I set up all seven using the exact same process, so I don’t know what these two are missing. Also, in my Apache logs directory, I have two log files, error
and access
for each of the two misbehaving sites, but all of them are empty. When I restart the apache2
service, there are no errors. I have retraced my steps multiple times and I can not see any difference between the working sites and the non working sites.
What options do I have for diagnosing this problem? Can I force more verbose error logs somehow? Is there another log somewhere that I can reference?
Here is an example of a .conf
file for one of the malfunctioning sites:
<VirtualHost *:80>
ServerName www.local_example.com
ServerAlias local_example.com
ServerAdmin address@example.com
DocumentRoot /var/www/Websites/example.com
<Directory /var/www/Websites/example.com/>
Options Indexes FollowSymLinks MultiViews
# pcw AllowOverride None
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/
</Directory>
ErrorLog /home/example/Apache_Logs/local_example.com_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /home/example/Apache_Logs/local_example.com_access.log combined
ServerSignature On
</VirtualHost>
Вам нужно установить PHP, связать его с вашей установкой apache, а затем сказать apache, что корневой страницей является «index.php», а не «index.html», чтобы при запросе «/» он мог выполнить скрипт index.php.
1- установить движок PHP, например, как модуль apache SAPI:
apt install libapache2-mod-php7.0
2- поместите это в ваш виртуальный хост или в ваш файл /etc/apache2/apache2.conf:
DirectoryIndex index.php index.html
3- перезапустить apache
Теперь вы должны иметь возможность выполнять код PHP с помощью Apache httpd
Вам нужно установить PHP, связать его с вашей установкой apache, а затем сказать apache, что корневой страницей является «index.php», а не «index.html», чтобы при запросе «/» он мог выполнить скрипт index.php.
1 — установить движок PHP, например, как модуль apache SAPI:
apt install libapache2-mod-php7.0
2 — поместите это в ваш виртуальный хост или в ваш файл /etc/apache2/apache2.conf:
DirectoryIndex index.php index.html
3 — перезапустить Apache
Теперь вы должны иметь возможность выполнять код PHP с помощью Apache httpd