Custom HTTPD Config in DA

splitech

Verified User
Joined
Sep 28, 2004
Messages
49
Hello

Currently added 1 new hostname in my httpd.conf file through directadmin, now i have several problems need to remove, Need manual edit of httpd.conf file, Where is it located. Running DA 1.23.1 with Apache 2

HELP!!!!!!
 
There is a link in the admin page under the Extra Features section named Custom HTTPD Configurations.
 
I wonder if there is a way to customize only secure (or vise-versa) virtual host.
On the CMD_CUSTOM_HTTPD?domain=example.com page, customization is applied to both

<VirtualHost IP:80>
</VirtualHost>

and

<VirtualHost IP:443>
</VirtualHost>

sections.

Any ideas?
 
Would be a nice added feature!

Well I would like to see DA add the ability to edit each
<VirtualHost> tags seperately as I am using Tomcat
and JSP/Servlets for some of my sites and I would like
to add the appropriate JKMount directives for mod_jk
seperately. ie. I want a certain JSP or Servlet to run
securely the only way I could see accomplishing this is
by adding the JKMount directives within the <VirtualHost>
tags for the secure virtual host listening on port 443 or
whatever port it may be listening on. Furthermore when
using DA custom httpd configuration whatever is added
gets added to BOTH <VirtualHost> tags and I think we
as DA users should have the option of adding to these
tags seperately. As I don't want the directives added to
both. :)
 
Re: Would be a nice added feature!

gpfault said:
Furthermore when
using DA custom httpd configuration whatever is added
gets added to BOTH <VirtualHost> tags and I think we
as DA users should have the option of adding to these
tags seperately. As I don't want the directives added to
both. :)

I concur.

There needs to be the option(s) to select port 80, port 443, or both.

I have had to resort to adding various

<Directory /home/path/to/directory>
... Misc directives ...
</Directory>

to the main httpd.conf because some directives apply only to one connection type.

Thank goodness I have only a handlful of domains to manage.
 
To prevent DA from overriding your httpd.conf, change the file's owner to root. I also save an extra copy (httpd.conf.bak) just in case.

# cd /usr/local/directadmin/data/users/<user>
# chown root httpd.conf
# chmod 644 httpd.conf
# cp httpd.conf httpd.conf.bak

Now you won't "accidentally" delete the file through DA.
 
Last edited:
Have you fully tested your workaround?

Wow.

Sounds good if you are not having any problems. Maybe I will try your idea.

If you use JSP/Servlets a bunch, I have written a Java socket class to communicate with DA. Works with JSP/Servlets or could be used with a stand alone app.

Thanks,
 
Yikes2000 said:
To prevent DA from overriding your httpd.conf, change the file's owner to root. I also save an extra copy (httpd.conf.bak) just in case.

# cd /usr/local/directadmin/data/users/<user>
# chown root httpd.conf
# chmod 644 httpd.conf
# cp httpd.conf httpd.conf.bak

Now you won't "accidentally" delete the file through DA.

That method will work well. Another option, which is what I employ, is to chattr those files.

From the shell :
# chattr +i /usr/local/directadmin/data/users/<user>/httpd.conf

That prevents the file from being altered in any way. In fact, with the +i attribute, the file cannot be renamed, cannot be deletd, cannot be written to, nor can you even create a link to the file.

# chattr -i /usr/local/directadmin/data/users/<user>/httpd.conf
to unlock it.

I have all my httpd.conf files chattr'd +i .

For what its worth.

Mike
 
Thanks for your solutions.

Thank You for your solutions. I learn more and more everyday. :) Anyone know a way to be logged into SSH as root and can then copy a users home directory say from a backup archive but when copying the home directory all ownerships would stay they way they should be? ie. I have a hypothetical customer /home/abc/ I want to be able to copy ALL the files for customer abc from a backup archive but keep the correct owner and group associated with the copied files. I managed to do this but in a round about way. I am curious if there is an easy way to do it?

Thank You,
 
Re: Thanks for your solutions.

gpfault said:
Anyone know a way to be logged into SSH as root and can then copy a users home directory say from a backup archive but when copying the home directory all ownerships would stay they way they should be?

Why don't you use TAR utility?
Backup your user with
Code:
cd /home
tar cvfz /BACKUPS/yourclient.tgz yourclient

then restore it with
Code:
tar xvfz /BACKUPS/yourclient.tgz

all ownership and permissions should be the same if you are doing this as root.

You can also use "rsync -avz" command to make backups provided that rsync is installed on your server.
Hope that helps.
 
If you used tar to create the backup then the backup has the right permissions and ownerships already set.

To restore them you should also use tar.

"man tar" is your friend.

Jeff
 
Restore

Yes I realize what you are saying but what if I am using a full system backup. Is there a way to just extract the one users "home" directory from the archive?
 
Re: Restore

gpfault said:
Yes I realize what you are saying but what if I am using a full system backup. Is there a way to just extract the one users "home" directory from the archive?

I second Jeff: man tar is your friend :)

Here is a snapshot:
-x
--extract
--get
Extract files from an archive. The owner, modification
time, and file permissions are restored, if possible. If
no file arguments are given, extract all the files in the
archive. If a filename argument matches the name of a
directory on the tape, that directory and its contents are
extracted (as well as all directories under that direc-
tory). If the archive contains multiple entries corre-
sponding to the same file (see the --append command
above), the last one extracted will overwrite all earlier
versions.
 
Re: Re: Restore

Webcart said:
I second Jeff: man tar is your friend :)

Here is a snapshot:

Okay. Thank you for all your input. It's just been a very long day and I have not used tar for restores for a very long time.

I appreciate all your help. Thanks again.
 
Back
Top