Apache/2.4.7 (Ubuntu) - mod_dumpio not logging post data - apache

I can't seem to get the Apache module mod_dumpio to log anything.
I have tried the suggestions in this post
To be sure I have tried the following
Disabled all of my vhosts except the one for the site I am working on
Ran a2enmod dump_io, and restarted Apache, can see it in /etc/apache/mods-enabled/dump_io.load
Check that /etc/apache/apache.conf LogLevel is dumpio:trace7 too
I open the log tail -f n 20 /var/log/apache2/packager-access.log
Run the following command to send some post data --data "param1=value1&param2=value2" http://packager.local/api/package/create
Can only see lines like 127.0.0.1 - - [12/Nov/2014:10:07:04 +0000] "POST /api/package/create HTTP/1.1" 500 294 "-" "curl/7.35.0"
The vhost conf is as below
<VirtualHost *:80>
DocumentRoot /var/www/packager/web
ServerName lms-packager.local
ErrorLog ${APACHE_LOG_DIR}/packager-error.log
CustomLog ${APACHE_LOG_DIR}/packager-access.log combined
DumpIOInput On
DumpIOOutput On
LogLevel dumpio:trace7
</VirtualHost>
Is there anything else that I could try

After reading this post, I tried to move the configuration to the server level.
As the post suggests the key point from the Apache manual is
server config This means that the directive may be used in the server
configuration files (e.g., httpd.conf), but not within any
or containers. It is not allowed in
.htaccess files at all.
The following is also important so only check your ErrorLog file (e.g. /var/log/apache2/error.log) rather than any vhost file which makes sense if this is a server config
to be logged (dumped) to the error.log file

Related

Apache2 SSL "Action 'start' failed" The apache error log may have more information

I have a fully working apache2 server with moodle installed.
I'm trying to get the frontpage/entire site to work with ssl.
When i try to start apache2 with "apachectl start" i get the error:
Action 'start' failed. Theapache error log may have more information
/var/log/apache2/access.log:
... "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.10 (Ubuntu) OpenSSL/1.0.1f (Internal dummy connection)
The rest of the file is just http GET requests.
/etc/apache2/sites-enable/000-default.conf
<VirtualHost *:443>
DocumentRoot /var/www/html/moodle
SSLEngine on
SSLCertificateFile /home/osboxes/CertificadosSSL/test.csr
SSLCertificaKeyFile /home/osboxes/CertificadosSSL/test.key
ErrorLog ....
CustomLog ....
</VirtualHost>
I'm new to apache. If there is any vital information vital missing let me know.
Thanks in advance.
The error message isn't clear about it, but apache2 could not restart because your /etc/apache2/sites-enable/000-default.conf contains a typo and is not able to locate your certificate key file:
Repair it by changing SSLCertificaKeyFile to: SSLCertificateKeyFile
After changing this file, try to restart apache2.

Apache 2.4 AliasMatch keeps returning 404 when Alias works

I'm trying to redirect calls to my Apache 2.4 virtual host (Wampserver 2.5) that match a certain pattern to a directory outside of my DocumentRoot. Here is the relevant code from my .conf file:
<VirtualHost *:80>
ServerName testserver.dev
DocumentRoot "D:\Path\to\webserver\public\build"
RewriteEngine On
LogLevel alert rewrite:trace6
# Statement below results in 404
AliasMatch "^/sitemap.\d+.xml.gz$" "D:\Path\to\webserver\private\index.php"
</VirtualHost>
When I make a call to apache such as http://testserver.dev/sitemap.1.xml.gz I get a 404 returned from the server. From what I can tell the match is actually working so I'm assuming the directory path is somehow configured wrong? If I hardcode it and use just plain Alias it works as intended:
# This works below
Alias /sitemap.1.xml.gz "D:\Path\to\webserver\private\index.php"
Not sure what I'm doing wrong. I have logging enabled and this is what shows up in the error log:
init rewrite engine with requested uri /sitemap.1.xml.gz
pass through /sitemap.1.xml.gz
And in the access log for the requests that don't work
"GET /sitemap.1.xml.gz HTTP/1.1" 404 304
Anyone have any idea? I figure this has to be something simple I'm overlooking.
I figured this out after realizing I wasn't seeing the Alias logging.
First I added this LogLevel:
LogLevel debug alias:trace6
Which allowed me to see that when it was trying to replace the regular expression matches (which i'm not using) the backslashes were being removed in my target directory. Since I'm on Windows I changed the path to the following:
D:/Path/to/webserver/private/index.php
And it now maps the path as intended.

Weblogic-Apache Bridge

I already have a set-up in my production environment and just trying to understand how exactly this works? Please help me understand ,
Set-up :
We have 2 diff kinda set-up. ie, the url https://ddd.myserver.net:111/ABC and https://ddd.myserver.net:222/ . Apache server (ddd.myserver.net)is configured with Listen port 111 to service application ABC and the same server is configured with Listen port 222 to serve application XYZ.
i.e, https://ddd.myserver.net:111/ABC - Is mapped to the application ABC thats deployed on Weblogic Server.
and https://ddd.myserver.net:222/ - Is mapped to the application XYZ thats deployed on the same Weblogic Server.
Now my question is, the former link (https://ddd.myserver.net:111/ABC) works fine only if the context root(ABC) is appended to the url. IF i try as https://ddd.myserver.net:111/ then the apache_wl.log mentions that there s no page found.
ie.,
URL::parseHeaders: CompleteStatusLine set to [HTTP/1.1 404 Not Found]
URL::parseHeaders: StatusLine set to [404 Not Found]
But then the second one (https://ddd.myserver.net:222/) just works fine without even mentioning the context root in the url.
Now All I need to know is, how and where is this config likely to be set? Where in the link works without even mentioning the context root?
Thanks.
[UPDATE]
I have already looked at the httpd.conf and ssl.conf but couldn't really make out where this has been configured.
[UPDATE 2]
Here's the important code snippet, if you require any specific config property pls let me know.
httpd.conf
Include conf.d/ssl.conf
UseCanonicalName Off
DocumentRoot "C:/Test/WS/ABC/ABC"
Alias /ABC "C:/Test/WS/ABC/ABC"
ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Listen 111
<VirtualHost *:111>
DocumentRoot "C:/Test/WS/ABC/ABC"
ServerName ddd.myserver.net
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
<IfModule mod_weblogic.c>
WLLogFile logs/abc_wl.log
Debug OFF
DebugConfigInfo OFF
WebLogicCluster test.myserver.net:7001,test.myserver.net:7003,test.myserver.net:7005
MatchExpression *
</IfModule>
</VirtualHost>

Ruby on Rails - etc/hosts config file

This is what I have in my "etc/hosts" file:
127.0.0.1 localhost
127.0.1.1 gotqn-System-Product-Name
127.0.0.1 depot.yourhost.com
and this is what I have added in the apache2.conf file:
<VirtualHost *:80>
ServerName depot.yourhost.com
DocumentRoot "/home/gotqn/Aptana Projects/depot/public/"
<Directory "/home/gotqn/Aptana Projects/depot/public">
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I type http://localhost/ my browser lists all my files in the "var\www" folder and when I type http://depot.yourhost.com/ it displays the following error:
We're sorry, but something went wrong.
I have checked the production.log file of my rails applications and it says:
Connecting to database specified by database.yml
Started GET "/" for 127.0.0.1 at 2013-01-13 20:32:41 +0200 Processing
by StoreController#index as HTML Completed 500 Internal Server Error
in 3ms
ActiveRecord::StatementInvalid (Could not find table 'carts'):
app/controllers/application_controller.rb:46:in rescue in
current_cart' app/controllers/application_controller.rb:44:in
current_cart' app/controllers/store_controller.rb:11:in `index'
I suppose that there is something wrong with my database configuration as the table exists but it is not found.
Anyway, my questions is how the hosts file knew that "depot.yourhost.com" means to open the rails applications and "localhost" do list my "var\www" folder - I have thought that RoR is using port 3000.
Why there is no conflict for port 80?
Rails applications run under port 3000 when running with the lightweight Webrick server. Since you are running Apache with mod_passenger, the application will be available at port 80 according to your Apache configuration.
The hosts file contains an entry 127.0.0.1 depot.yourhost.com which directs that domain name to your local adapter 127.0.0.1. The hosts file should always be checked before a nameserver needs to be consulted to retrieve a name's address.
Next, your Apache configuration includes a VirtualHost which is listening on all network adapters due to the * in
<VirtualHost *:80>
Your Apache configuration must be setup to use name-based virtual hosting, after which the ServerName variable is matched against the HTTP_HOST request header which was supplied by your request to depot.yourhost.com.
Therefore, you can have as many VirtualHosts as needed all using port 80 on the same IP address, and Apache will decide which to route the request to based on the HTTP_HOST header.
Finally, mod_passenger will detect if an application is a Ruby on Rails application by inspecting the directory contents around the DocumentRoot which you have specified in the VirtualHost configuration. If it finds the public directory as its DocumentRoot and a RoR application at a level higher, Passenger will attempt to start the Rails app.
Now, as to why you are getting a directory listing from localhost... Elsewhere in your Apache configuration you must have a VirtualHost which matches the ServerName localhost and sets its DocumentRoot to /vart/www.
<VirtualHost *:80>
ServerName localhost
# or...
ServerAlias localhost
</VirtualHost>
If you are seeing the contents of the directory listed out rather than a 403 Forbidden (absent an index file like index.html), it is because the Apache server config or VirtualHost config does not include the directive:
Options -Indexes
Add that in the global httpd.conf to prevent listing directories server-wide.

Symfony - name based virtual servers on localhost - is this possible?

I am rapidly coming to the conclusion that this is not feasible, although for some reason, people - most likely who have not implemented the 'advice' they give, seem to think this is possible.
The scenario is quite straightforward. I am developing symfony websites on my local dev machine, running Ubuntu 10.0.4 LTS. I want to be able to run and test multiple sites locally.
Assuming I have the following sites:
site1.localhost
site2.localhost
site3.localhost
Following the documentation here, here and here (none of which work for me), I have done the following:
A. I modified my /etc/hosts file with the first entry to be:
127.0.0.1 site1.localhost site2.localhost hpdtp-ubuntu910
localhost php.localhost
B. I modified my /etc/apache2/ports.conf file (first lines) as follows:
NameVirtualHost localhost:80 Listen 80
C. I have created configuration sites for each of the websites (site1.localhost and site2.localhost). Each configuration is a separate file in /etc/apache2/sites-available
One such configuration file (for site1.localhost) in /etc/apache2/sites-available/site1 looks like this:
<VirtualHost localhost:80>
ServerName site1.localhost
DocumentRoot "/home/morpheous/work/webdev/frameworks/symfony/sites/site1/web"
DirectoryIndex index.php
<Directory "/home/morpheous/work/webdev/frameworks/symfony/sites/site1/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /lib/vendor/symfony/symfony-1.3.6/data/web/sf
<Directory "/lib/vendor/symfony/symfony-1.3.6/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
D. I have disabled the default apache site by using (it kept showing up instead)
E. Since I can't enable all the sites I enable to work (like the documentation links above
purport), I have settled for enabling one site at a time, so that Apache dosen't get its confused as to which site to run. When I need to run another site, I disable the current one and enable the one I want to. This is (obviously?) far from ideal - but even this setup is not working - for the reasons listed below.
i). When I restart Apache, I get the following warning:
Reloading web server config apache2
[Sun Jul 18 10:32:23 2010] [warn]
NameVirtualHost localhost:80 has no
VirtualHosts
ii). when I navigate to http://site1.localhost
I get the following error message in FF:
Oops! This link appears to be broken
iii). My apache related errors are appearing in /var/log/apachche2/other_vosts.log
morpheous#hpdtp-ubuntu910:~$ tail /var/log/apache2/other_vhosts_access.log
site1.localhost:80 127.0.0.1 - - [18/Jul/2010:10:08:38 +0100] "GET / HTTP/1.1" 404 506 "-" "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6 GTB7.1"
site1.localhost:80 127.0.0.1 - - [18/Jul/2010:10:09:30 +0100] "GET / HTTP/1.1" 404 506 "-" "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6 GTB7.1"
site1.localhost:80 127.0.0.1 - - [18/Jul/2010:10:09:31 +0100] "GET /favicon.ico HTTP/1.1" 404 505 "-" "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6 GTB7.1"
site1.localhost:80 127.0.0.1 - - [18/Jul/2010:10:09:36 +0100] "GET /favicon.ico HTTP/1.1" 404 505 "-" "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6 GTB7.1"
My questions are:
Can Apache be setup to handle multiple virtual hosts on localhost? Afterall, all examples I have seen so far involve setting Apache with public facing ip addresses
If Apache can indeed handle multiple sites on localhost, which of the steps above am I doing incorrectly?. AFAICT, I have followed the documentation to the letter.
Yes, you can have several VirtualHosts, on your local machine -- It's exactly the same as when working on a remote server, except the IP address and domain-name are not the same.
What I generally do is :
Edit the hosts file
To add the new domain-names that I want served from my local computer.
For example, I would add :
127.0.0.1 tests
127.0.0.1 blog
And so on, with one line for each domain-name I want.
Add new VirtualHosts to Apache's configuration
Then, I add new VirtualHosts to Apache's configuration.
First site : tests
For example, for my tests domain-name, I would use :
<VirtualHost *:80>
ServerName tests
DocumentRoot /home/squale/developpement/tests
<Directory /home/squale/developpement/tests>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
</VirtualHost>
A couple of things to note here :
The VirtualHost is on *:80
So, it'll listen to any address
The mapping to the domain-name is made by the ServerName directive
Of course, up to you to make sure that this VirtualHost is seen by Apache -- either by placing it's configuration in a loaded file (not recommended), or by :
Placing that configuration in a new file in /etc/apache2/sites-available/
Using a2ensite to enable the site
Which will create a symbolic-link in /etc/apache2/sites-enabled/, pointing to your new configuration file.
Second site : blog
And here the configuration I'd use for a second domain-name, that correspond to blog :
<VirtualHost *:80>
ServerName blog
DocumentRoot /home/squale/developpement/blog.pascal-martin.fr/www
<Directory /home/squale/developpement/blog.pascal-martin.fr/www>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
</VirtualHost>
It's basically exactly the same thing ; only two differences :
The ServerName directive correspond to my second domain-name -- of course
And the DocumentRoot is not the same
Other files ?
I don't really change anything else to Apache's default configuration (I'm on Ubuntu, if that matters).
For example, I don't change anything in the ports.conf file : I still have the default NameVirtualHost and Listen directives :
NameVirtualHost *:80
Listen 80
Only important modifications I do are to enable some modules, like rewrite, expires, ... But that's not much related to your VirtualHosts problem ;-)
Results ?
If I open my browser and go to http://tests/, I get the things I would expect from my tests domain -- a list of directories and files, here.
And if I open my browser and go to http://blog/, I get the development instance of my blog -- well, and error page, saying that I forgot to set up the database ^^
Did you create a link from /etc/apache2/sites-available/site1 to /etc/apache2/sites-enabled/site1 ?
I'm using nginx instead of apache but ubuntu has standarized way of configuration. Usually sites-available includes all your configurations which are not included by apache. It only looks for configurations linked in sites-enabled directory.
I also don't think you need to enable one site a time. All should work. All have different domain names.