My httpd.conf is empty - apache

I recently installed apache2 on ubuntu but I have a problem, my httpd.conf is empty. Can someone give me a clean copy of httpd.conf for apache2 on ubuntu?
Thanks!
Edit: I saw your answers but on wampserver httpd.conf is not empty and as you mentioned it is for user options. SO what should I do?
Edit2 : That's what I got on my apache2.conf, how I add modules, enable gzip and all of that?
[Deleted the contents, as they render the question unreadable and are useless, because that were the default Apache2 configuration under Ubuntu.]

The /etc/apache2/httpd.conf is empty in Ubuntu, because the Apache configuration resides in /etc/apache2/apache2.conf!
“httpd.conf is for user options.” No it isn't, it's there for historic reasons.
Using Apache server, all user options should go into a new *.conf-file inside /etc/apache2/conf.d/. This method should be "update-safe", as httpd.conf or apache2.conf may get overwritten on the next server update.
Inside /etc/apache2/apache2.conf, you will find the following line, which includes those files:
# Include generic snippets of statements
Include conf.d/
As of Apache 2.4+ the user configuration directory is /etc/apache2/conf-available/. Use a2enconf FILENAME_WITHOUT_SUFFIX to enable the new configuration file or manually create a symlink in /etc/apache2/conf-enabled/. Be aware that as of Apache 2.4 the configuration files must have the suffix .conf (e.g. conf-available/my-settings.conf);

It's empty by default. You'll find a bunch of settings in /etc/apache2/apache2.conf.
In there it does this:
# Include all the user configurations:
Include httpd.conf

OK - what you're missing is that its designed to be more industrial and serve many sites, so the config you want is probably:
/etc/apache2/sites-available/default
which on my system is linked to from /etc/apache2/sites-enabled/
if you want to have different sites with different options, copy the file and then change those...

It seems to me, that it is by design that this file is empty.
A similar question has been asked here:
https://stackoverflow.com/questions/2567432/ubuntu-apache-httpd-conf-or-apache2-conf
So, you should have a look for /etc/apache2/apache2.conf

Related

Where to put Apache vhost configuration (httpd-vhosts.conf or httpd.conf)?

I just to ask a simple question. I am studying the vhost configuration but I am confused where should I properly put my vhosts configuration?
I have a file that has a name httpd-vhosts.conf and httpd.conf
I try to put my configuration in these 2 files but different web projects. And after I restarted my Wampserver I can access them. Is it fine if I place all my vhost entries in the file httpd-vhosts.conf ? Or should I place it in httpd.conf
There is no right or wrong. Apache has one global config file, which typically is the default or specified in the startup script.
This file then uses one or more secondary config files and directories. Different Linux distributions use different default include directories.
On CentOS I think for example you would put a file (named like your domain but can be anything) in /etc/httpd/conf.d/example-com.conf: http://wiki.centos.org/TipsAndTricks/ApacheVhostDir

Changing var/www to something else

I've installed Ubuntu on a Oracle VM Virtual box, and installed Apache etc.
How do I change the var/www folder that Apache uses, to something else? Can I simply rename it? I'm, trying to change it to nordy/core, in place of var/www.
Can I create a separate folder called nordy/core and place my html files there? One of the reasons I did not do this it because I noticed that var/ has several other folders that will not be created if I simply create a new folder. So, I'm guessing the site wont work.
I'd like to store my html and php files in a folder nordy/core so Apache can use it from there. Can I simply create a folder nordy/core and point Apache to it in Apache's configuration?
How do I do this?
You need to change the value of the DocumentRoot directive of your apache2.conf file. You may find this file at /etc/apache2/apache2.conf.
DocumentRoot "/nordy/core"
Then restart your apache process.
sudo service apache2 restart

Difference between httpd.conf, php.ini and .htaccess

I am about to start learning Apache. All resources I am looking into, mention either php.ini, or .htaccess or httpd.conf files for setting configurations and stuff. But none of them are clear on the difference between these 3 files. Can anyone explain the difference and their usage?
httpd.conf (it can actually be named differently on some platforms, but that's the default) is the master configuration file for Apache. You can use Include statements to pull in external configuration files. httpd.conf is read in when Apache starts or if you run a 'reload'.
.htaccss is a per-directory configuration file for Apache. You can enable or disable the use of .htaccess files in your httpd.conf file. Where possible its been recommended to me to turn .htaccess use off, as Apache will check the file every time a request causes it to read the directory.
PHP is, as you probably know, separate from Apache, although often used with it. php.ini is the configuration file for the PHP engine.
Every daemon or application has it's own configuration files. On linux these are often located in the /etc directory. You will have to learn to edit each one according to the program. the /etc/php5/php.ini is different from the /etc/apache2/httpd.conf and so on.
Think of them like different types of files. a Word document is not the same as a JPEG Image or a AVI video.
The PHP.ini controls PHP's settings
The .htaccess controls apache settings for a given folder (and all child folders)
The httpd.conf controls apache's settings.
php.ini is a configuration file where you specify options for things
related specifically to php, for instance CURL
.htaccess is where you specify options for URI routing and folders
options on your server
httpd.conf is a configuration file where you specify options for
things related specifically to apache

Apache 2.2 on XP: How configuration files are managed? Where should they be located?

New to Apache, and suffering...
Seems to be true:
the default configuration is in Apache directory Apache2.2/conf/httpd.conf
Unsure of that:
it can be elsewhere
to create some separation between test/production, it seems that the best option is
to store all test files, including configuration and logs, in the same directory, with subdirectories conf, log, htdocs, and all production files in another directory using a similar structure.
if my upper directory is d:mywww, then the server needs to be started with the associated configuration file, e.g. httpd -f "d:mywww/conf/httpd.conf"
What will happen to the default configuration file if the -f option is used. Will it be ignored?
If instead of the -f option, you use httpd -d "d:mywww/htdocs" to indicate the directory to serve, but not any configuration file, will the default config file be used and the one under d:mywww/conf ignored?
Can someone confirm or deny?
Is there a well known site with a good introduction on setting up Apache, if possible on Windows. I found the Apache documentation a little bit difficult, and Apache Definitive Guide not clear about this kind of questions.
I was new to Apache 2 months ago, and still suffering. Since you got no replies from pros yet, I'll chip in my 2 cents: (all for Ubuntu 10.10)
httpd.conf is used for your personal configurations, so I'd say that it is not the default configuration file as you specify. The default would be, in my case at least, in /etc/apache2/apache2.conf
you can have a bunch of other conf files. In my case, I can place any file with an extension .conf inside /etc/apache2/conf.d/ and it will be picked up by Apache on restart.
Don't know about the rest. Hope it helps you

apache - how to override index of /icons?

I wasn't aware of this, and it is kind of funny; when you name a directory icons in the root of your host, then if you point your browser to host.com/icons, apache does not read from that directory and shows you a listing of Public Domain Icons.
I added an icons directory to the root and placed a key.png file in that directory, yet accessing that image results in 404. I tried to find if/where this has been documented and how it could be turned off. I found nothing. Could someone provide a pointer?
P.S. I am using XAMPP 1.7.3 which basically is a WAMP and has Apache 2.2.14
Edit
Aparently lots of live servers have this turned on and index of /icons could be seen lots of places.
Open this file: %XAMPP_PATH%\apache\conf\extra\httpd-autoindex.conf
and change :
Alias /icons/ "X:/xampp/apache/icons/"
<Directory "X:/xampp/apache/icons/">
to this:
Alias /icons/ "./icons/"
<Directory "./icons/">
Restart your Apache Server.
I'd assume that you have an alias within your httpd.conf.
I'm not familiar with XAMPP's config files or their location (google suggests it's probably in \xampp\apache\conf\httpd.conf) but I'd suggest you're looking for a line like the following:
Alias /icons/ /usr/local/apache/icons/
See http://httpd.apache.org/docs/current/mod/mod_alias.html for more info.
EDIT:
According to XMAPP site, you need to check \xampp\apache\conf\httpd.conf and the extra subfolder.
I would look in either your apache config file (\xampp\apache\conf\httpd.conf) or your .htaccess files and see if there is a redirect going on.
EDIT: I think Grhm is correct in that an Alias is in your config file somewhere, per the XAMPP site:
The main configuration file for Apache. It's including other files from the subdirectory "extra".
See if there is a directory called extra in the \xampp\apache\conf\ directory and then go through the files in there and see if that Alias is present.