Apache2 not outputting errors on webpage - apache

Im on Linux (debian based), and my apache2 localhost doesn't give any warning / error messages. The apache error.log located at var/log/apache2/error.log gives errors / warnings but it will never output something on my website.
I made a file called /etc/apache2/sites-available/html.conf with the neccesary info:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName localhost
ServerAlias www.localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
however, If i change line 6 to the location of my error.log file (var/log/apache2/error.log), It does nothing.
EDIT:
I solved the problem
I had to change this line: log_errors = Off
to: log_errors = On
In the php.ini file (Line 503)

Related

client denied by server configuration: website_c.wsgi, referer: http://website_b.com/

I'm not a sysadmin, but I do my best, so apologies in advance for my ignorance.
I run a linux server with apache2 on it. I have 3 websites I am trying to host on it, but the sites-enabled/000-default.conf file must be misconfigured.
Basically, website_c seems to be preventing website_b from showing up, as per the error message in the title. website_a and website_c show up correctly.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/ghost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
# Servers to proxy the connection, or
# List of application servers Usage
ProxyPass / http://localhost:2369/
ProxyPassReverse / http://localhost:2369/
ServerName website_a.com
ServerAlias www.website_a.com
</VirtualHost>
<VirtualHost *:80>
ServerName website_b.com:80
DocumentRoot /var/www/website_b
ServerAlias www.website_b.com
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
<VirtualHost *:80>
ServerName website_c.com:80
ServerAlias .*
WSGIScriptAlias / /home/username/python_envs/production/website_c/apache/production-website_c.wsgi
<Directory /home/username/python_envs/production>
Require all granted
</Directory>
</VirtualHost>
WSGIScriptAlias / /home/username/python_envs/production/website_c/apache/production-website_c.wsgi
WSGIPythonHome /home/username/python_envs/production
WSGIPythonPath /home/username/python_envs/production/website_c
Alias /rgc-dev/static/ /home/username/python_envs/dev/website_c-static/
WSGIScriptAlias /rgc-dev /home/username/python_envs/dev/website_c/apache/dev-website_c.wsgi
Alias /rgc-staging/static/ /home/username/python_envs/staging/website_c-static/
WSGIScriptAlias /rgc-staging /home/username/python_envs/staging/project_container/website_c/apache/staging-website_c.wsgi
Alias /rgc-production/static/ /home/username/python_envs/production/website_c-static/
WSGIScriptAlias /rgc-prod /home/username/python_envs/production/website_c/apache/production-website_c.wsgi
The error message in the apache log when I try to access website_b is: client denied by server configuration: /home/username/python_envs/production/website_c/apache/production-website_c.wsgi, referer: http://website_b.com/
Can anyone spot the issue with my apache conf? Please let me know if you need me to post the production-website_c.wsgi, I can't see anything that looks relevant there.
Thank you!
this was the problem:
WSGIScriptAlias / /home/username/python_envs/production/website_c/apache/production-website_c.wsgi
I commented out that line and website_c was still displaying correctly, so there ya go.

Apache don't load all virtualhost

i have a problem with apache and the virutalhosts on ubuntu server.
The software installed on my machine is:
Ubuntu 14.04.3 LTS
Apache 2.4.7
The virtualhost are configured in /etc/apache2/sites-avaiable/ directory and i have 4 files:
000-default.conf
default-ssl.conf
I maked these files:
site-one.example.com.conf
site-two.example.com.conf
The only difference is the name of subdomain an domain, so, the configuration of both files is:
site-one.example.com.conf:
<VirtualHost *:9292>
ServerName site-one.example.com:9292
ServerAlias www.site-one.example.com:9292
ServerAdmin webmaster#localhost
DocumentRoot /var/www/prod/
alias /a /var/www/prod/a
alias /a-test /var/www/test/a
alias /f /var/www/prod/f
alias /p /var/www/prod/p
alias /p-test /var/www/test/p
alias /t /var/www/prod/t
alias /w /var/www/prod/www/w
alias /t-test /var/www/test/t/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
site-two.example.com.conf
<VirtualHost *:9292>
ServerName site-two.example.com:9292
ServerAlias www.site-two.example.com:9292
ServerAdmin webmaster#localhost
DocumentRoot /var/www/prod/
alias /s /var/www/prod/www
alias /s-test /var/www/test/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The problem is when i try to load the url "site-one.example.com/a" the server not found the files but the url by "site-two.example.com/s" works good, i've been trying restarting Apache(sudo service apache2 restart or reload or stop/start) but when i do that site-one.example.com works fine and the other stop working and said "The requested URL /a was not found on this server."
¿How can i find some log file about the virutalhost?
I found the problem, the server fist read the configuration of 000-default.conf file, so i commented all the lines, i restarted apache and works fine.
however, i would like to know, why sometimes apache takes one *.conf file or other???

httpd subdomain 404 error

I have a working site at on the Top level of a domain, I now want to add a subdomain on the same domain and the same server.
The files for this site are located in the public html folder (/var/www/html)
I have the following virtualhosts/directory config in httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin support.portal#somesite.com
DocumentRoot /var/www/html/joomla3
ServerName support.somesite.com
ErrorLog logs/support.somesite.com_error.log
CustomLog logs/support.somesite.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin support.portal#somesite.com
DocumentRoot /var/www/html/moodle
ServerName support.somesite.com/moodle
ErrorLog logs/moodle.error.log
CustomLog logs/moodle.access.log common
</VirtualHost>
<Directory "/var/www/html/moodle">
DirectoryIndex index.php
AcceptPathInfo on
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
No errors are reported on the start/restart of httpd
Nothing is reported in the httpd error log. The below entry is shown in the Access log so the request is reaching the webserver but appears to be not being handled properly by the webserver.
192.168.4.202 - - [05/Jan/2015:12:49:14 +0000] "GET /moodle HTTP/1.1" 404 290
I have configured something similar before but I can't figure out the problem here. I might have missed something obvious, Can you see where the problem is, Thanks?
I am running CentOS 6.5 for reference.

Change Document root of LAMP folder

I need to change the document root to something else.
for example I want my root as ~/Dropbox/www instead of /var/www/html
To achieve that I've changed my /etc/apache/sites-availabl/000-default.conf file
to
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster#localhost
DocumentRoot ../../home/ahmar/Dropbox/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
when I restart the server it seems fine
But When I open my localhost
it gives me a forbidden error
with this message
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
Try Putting
"DocumentRoot /home/ahmar/Dropbox/www/"
It should fix the problem. :)

VIrtualHost: Different hosts point to the same location

I am trying to set virtual hosts for two Zend Framework applications. I started by changing the system32 hosts file.
It contains the following lines now:
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 quickstart
After that, I proceeded with changing the httpd-vhosts.conf file. Its current content:
<VirtualHost *:80>
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "G:\workspace\Andrew\ProjManer\public"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "G:\workspace\Andrew\quickstart\public"
ServerName quickstart
ServerAlias quickstart
ErrorLog "logs/quickstart-error.log"
CustomLog "logs/quickstart-access.log" combined
</VirtualHost>
If I don't add the virtual host with localhost first, I get a "Access forbidden 403 Error message".
The problem now is that both point to the same location, the localhost. How am I supposed to get the second virtual host working? I used the flushdns also.
You don't need the ServerAlias in them unless you want say quickstart2 to go to quickstart. In that case you will do ServerAlias quickstart2. You get access forbidden because your document root in your httpd.conf doesn't have an index.php or that virtualhost doesn't have an index.php and you have -Indexes set
Other than that the virtualhost and hosts file look fine. Try restarting your browser and restarting apache.