Set AllowOverride ALL on Apache 2.4 as default for domains - apache

I recently updated from Apache 2.2 to Apache 2.4 and noticed my sub-directories on some domains were no longer showing (visiting via http resulted in a blank page). I am 50% confident this has something to do with the switch to default AllowOverride to 'none'.
Where do I set this to ALL so that the sub-directories will display again and is there a universal fix I can use to make it act as Apache 2.2 did or do I need to do it on a domain by domain or even directory by directory basis?
I am on a cPanel server (LAMP) with CentOs.

I think best way its use WHM EA Custom Templates
To create custom template files that affect how cPanel & WHM builds entries for all virtual hosts, perform the following steps:
Create a copy of one or more of the following files:
Apache 2.2 with SSL — /var/cpanel/templates/apache2_2/ssl_vhost.default
Apache 2.4 with SSL — /var/cpanel/templates/apache2_4/ssl_vhost.default
Apache 2.2 without SSL — /var/cpanel/templates/apache2_2/vhost.default
Apache 2.4 without SSL — /var/cpanel/templates/apache2_4/vhost.default
Rename the copied file to one of the following filenames:
vhost.local — Use this filename if you copied the vhost.default file.
ssl_vhost.local — Use this filename if you copied the ssl_vhost.default file.
Edit the *.local files to make the desired changes to your virtual host configuration.
It's easy. After create your custom template
/scripts/rebuildhttpdconf
service httpd restart

Related

WAMP localhost and phpmyadmin setup

I have inherited a WAMP setup, but needed my http://localhost to point to a different directory "C:/Users/[user.name]/htdocs" due to many dependencies.
I made the following changes in httpd.conf
DocumentRoot "C:/Users/[user.name]/htdocs"
<Directory "C:/Users/[user.name]/htdocs">
where the original path was "c:/wamp/www/"
Now the WAMP default path for phpMyAdmin http://localhost/phpMyAdmin is not working anymore.
Is it possible to fix that via either C:\wamp\alias\phpmyadmin.conf or httpd-vhosts.conf somehow?
Can I suggest a better solution to your requirement to have a site running that does not live in the WAMPServer default location i.e. \wamp\www or \wamp\www\somefolder
If you revert all your httpd.conf changes to the out of the box state and then create a Virtual Host to run the site you have located in your \user.... folder.
Virtual Hosts are a standard Apache feature that allows you to run may sites from a single instance of Apache, a bit like a shared hosting package setup.
You would then have the benefits of the WAMPServer homepage running on localhost and all the other alias's tools as well.
You can then run your site using a nice url for example sitename.dev and the virtual host definition also allows you to setup any site specific requirements without effecting any other site you may want to run.
There is a HowTo Setup Virtual Hosts here on SO

Apache - virtualhosts and global apache config

I have an apache server configured with multiple NameVirtualHosts running on the same IP. This all works fine.
However, because of the "include conf.d/*" directive, apache also picks up config for cacti and phpmyadmin, which add in aliases for /cacti and /phpmyadmin, and those aliases appear to be valid for all virtualhosts. That is to say, I can go to http://firstvirtualhost/cacti and also http://secondvirtualhost/cacti, and I get the same page.
In my case, the default namevirtualhost is publicly visible, and I do not want tools like phpmyadmin or cacti to be visible under that URL
In fact, I don't want any random package to be able to make itself visible across all virtualhosts simply by creating a file for itself in conf.d.
You have to delete the line include conf.d from the global Apache configuration file, and optionally add it to your own private virtual host configuration file.

Unable to find httpd.conf

I'm running tomcat and I want to change the default webroot so that it points to another location. Is there a way to find out what's running tomcat or where the default webroot is set as I can't find httpd.conf which is where I believe it's usually set?
Cheers,
Alexei Blue.
**UPDATE:**
It's been a long time since I looked at this question that I forgot about it. In the end it turned out that we were using Apache HTTPD to accept requests from port 80. From there we had the webroot and ProxyPass rules set in the /etc/httpd/conf/virtual-hosts/default.conf file (these can also be set in /etc/httpd/conf/httpd.conf). From there we had several tomcat instances running, all hosted on different ports which are setup in apache-tomcat-x/conf/server.xml.
When I wrote this question I was trying to setup a new tomcat instance to run an application in development and was told I would need to change the webroot to access my application, which was incorrect. Instead what I needed was to include a ProxyPass rule so that when my application name was recognised in the URL, HTTPD would send the request to the correct tomcat instance to be processed.
E.g.
www.domain.com/myApplication
In /etc/httpd/conf/virtual-hosts/default.conf
ProxyPass /myApplication/ ajp://127.0.0.1:<ajp_port>/myApplication/
ProxyPassReverse /myApplication/ ajp://127.0.0.1:<ajp_port>/myApplication/
Where the ajp_port is setup in apache-tomcat-x/conf/server.xml. I needed to ensure that non of the ports conflicted with other tomcat instances so remember to check all ports i.e. Shutdown, HTTP, HTTP with SSL, AJP etc.
Tomcat doesn't use httpd.conf, that is an apache file. The location of the individual webapps are kept in their individual web.xml files, but the location of all the configs are in ../tomcat6/conf/server.xml and web.xml
Is it where the files come from you want to move, or where it compiles and executes them from?
As #Woody says, Tomcat does not use httpd.conf files: that's an Apache httpd thing (httpd is a web server, Tomcat is a Java application server).
You didn't mention what OS you are using or what package management software you are using (e.g. yum, apt, etc.) so I'll give you generic information as if you had downloaded and installed Tomcat directly from apache.org (which I usually recommend people do for a number of reasons).
Tomcat keeps its server-wide configuration in the conf/server.xml file in the Tomcat base installation directory (often called $CATALINA_BASE for convenience): here, you configure things like what types of connectors (e.g. HTTP, HTTPS, AJP, etc.) to use and which ports they should listen to, clustering configuration, session persistence, global JNDI and realm resources. There are also conf/web.xml and conf/context.xml files that define defaults for all webapps deployed on that instance of Tomcat, but it's best to leave those files alone unless you have a really good reason to modify them.
When you want to deploy a webapp (under the default configuration), all you need to do is drop a .WAR file into the $CATALINA_BASE/webapps/ directory and the webapp will be deployed into a "context path" (aka URL prefix) that matches the name of the file minus the ".WAR" suffix. So, if you have a WAR file called mygreatwebapp.war, then it will be deployed such that your clients can reach it at http://yourhost/mygreatwebapp/. There is a special name you can give a WAR file so that it has an empty context path: if you name your WAR file ROOT.war (case matters), then your webapp can be reached at http://yourhost/. (If you would rather use exploded-WAR directories instead of WAR files, everything above still applies except the directories simply don't have the .war extension).
Given your original question, it sounds like all you want to do is drop a ROOT.war file into $CATALINA_BASE/webapps (or replace the one that is already there): this will deploy whatever webapp you want into the URL space that you might call the "default webroot".
Update
If you want to change the directory where all the webapps live for a host, you can modify $CATALINA_BASE/conf/server.xml and change the <Host>'s appBase attribute to point to, say, /cfusion/main/www/. That will deploy all the WAR files and directories in /cfusion/main/www/ as separate webapps.
If you just want to serve a single webapp from an arbitrary location, you may create a deployment file under $CATALINA_BASE/conf/[EngineName]/[HostName]/[appname].xml. This is a standard file like META-INF/context.xml and contains a <Context> element except that you will have to specify a docBase which points to your webapp (e.g. /cfusion/main/www/mywebapp).

Apache2 SSL configuration in several files?

I have setup Apache2 with SSL on a Debian Linux (squeeze) box. In the /etc/apache2/sites-available/default-ssl the SSL Engine is already configured and working. Packages with web software often come with an extra pkg-apache.conf file with some virtualhost, alias and directory directives. How could I make such package available via https without putting the content of pkg-apache.conf into default-ssl? Adapting the to *:433 results in load errors.
You can use the Include directive within your SSL virtual host to point to your extra configuration file. You'll need to make sure that the directives within that extra file can be used within a VirtualHost section.

Hosting personal pages over a Redmine installation

I currently installed redmine on my server, and configured apache2 to run it in a virtualhost over mydomain.com
Thing is I also want to host some extra pages, at mydomain.com/personal, but since redmine is running the page is never found. How can I override this configuration to run both redmine and some personal pages?
You need the Alias directive to just create a virtual directory, which maps /public with some other real directory on the filesystem.