which httpd.conf file to edit

DaMick

Verified User
Joined
Sep 23, 2006
Messages
18
Location
BE
Hi all,

I'm having a small problem knowing which httpd.conf file to edit. The reason I'm asking this is for the fact that I'm running a PHP framework on my DA server. Normally all rules are set with a .htaccess file, but for the functionality that I want to integrate (with a subdomain) I need to edit my httpd.conf file to edit my virtual host entry.

To make more sense, this is what I do on my local windows system which has te be ported to my linux production server:

Code:
<VirtualHost 127.0.0.1>
  ServerName netronix.local
  DocumentRoot "C:/wamp/www/netronix/web"
  DirectoryIndex index.php
  Alias /sf C:/wamp/bin/php/php5.2.5/PEAR/data/symfony/web/sf
  <Directory "C:/wamp/bin/php/php5.2.5/PEAR/data/symfony/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
  <Directory "C:/wamp/www/netronix/web">
    AllowOverride All
    Allow from All
<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
  </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1>
  ServerName mijn.netronix.local
  DocumentRoot "C:/wamp/www/netronix/web"
  DirectoryIndex backend.php
  Alias /sf C:/wamp/bin/php/php5.2.5/PEAR/data/symfony/web/sf
  <Directory "C:/wamp/bin/php/php5.2.5/PEAR/data/symfony/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
  <Directory "C:/wamp/www/netronix/web">
    AllowOverride All
    Allow from All
<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ backend.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ backend.php [QSA,L]
</IfModule>
  </Directory>
</VirtualHost>
I saw that the httpd.conf user files are located under usr/local/directadmin/data/users/admin/httpd.conf, but at the top of te file it says that it is not smart to edit the file becouse the file will be overwritten once the user makes changes to this/her website. So where is the httpd.conf file that I may edit?

Thank you in advance
 
Serverwide settings are at /etc/httpd/conf/httpd.conf.

But if you're editing for an individual site, then the file you've found is the right file. The problem is that it can be edited by the server admin through the DA control panel.

If the DA control panel editing won't give you what you need, you'll have to edit the user's httpd file manually, then set it as immutable so DA can't change it. You may get errors during some functions/updates, but DA won't change the file if you've it as immutable.

See:
Code:
$ man chattr
for instructions.

Jeff
 
Thank you for the explanation. I'll try to get it to work through DA. But if not, I'll do it manualy. Last small thing, when does DA overwrite the users httpd.conf file? I'll need a subdomain, and it has come to my attention that when I create a subdomain through DA, a directory is automatically created. So I'll have to do that manualy as well.
 
Thank you for the explanation.
You're welcome.
Last small thing, when does DA overwrite the users httpd.conf file?
I really don't know all the times it could happen. It definitely happens when you make any changes that require it; for example if the user adds a domain. Perhaps someone else knows and will post here.
I'll need a subdomain, and it has come to my attention that when I create a subdomain through DA, a directory is automatically created. So I'll have to do that manualy as well.
I believe that anything done at one folder level will carry through to the folders below that folder, but I don't think that carries through for folders accessed as subdomains.

Jeff
 
Thank you for all your replay's. I have come to the conclusion that I have to set the httpd.conf file manualy. And so I did, but for some reason the changes don't take effect. I have restarted apache, but still no luck. The changes are simple so I don't see where I could have made a mistake:
Code:
<VirtualHost 78.46.46.242:80>


	ServerName www.netronix.be
	ServerAlias www.netronix.be netronix.be  netronixhosting.be www.netronixhosting.be
	ServerAdmin [email protected]
	DocumentRoot /home/admin/domains/netronix.be/public_html/web
	ScriptAlias /cgi-bin/ /home/admin/domains/netronix.be/public_html/cgi-bin/

	UseCanonicalName OFF

	SuexecUserGroup admin admin
	CustomLog /var/log/httpd/domains/netronix.be.bytes bytes
	CustomLog /var/log/httpd/domains/netronix.be.log combined
	ErrorLog /var/log/httpd/domains/netronix.be.error.log

	<Directory /home/admin/domains/netronix.be/public_html>
		Options +Includes -Indexes

		php_admin_flag engine ON
		<IfModule !mod_php6.c>
			php_admin_flag safe_mode OFF
		</IfModule>
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'


		php_admin_value open_basedir /home/admin/:/tmp:/usr/local/lib/php/


	</Directory>
	DirectoryIndex index.php
 <Directory "/home/admin/domains/netronix.be/public_html/web">
    AllowOverride All
    Allow from All
<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
  </Directory>




</VirtualHost>

I just made a change of rootdirectory and then made some rewrite rules. But for some reason, even the change of rootdirectory isn't applied. Does someone has an id on this?
 
Back
Top