PDA

View Full Version : Changing Web Paths


Shade
2003-09-25, 22:32 PM
Hey guys, I'm fully up and running... I need to do something though.

Right now, my path is this:

/home/username/public_html

I need to access it via my browser at the following path

/home/username/htdocs

I need to do this for one user only. Basically I need to change the way that the server handles the paths to make it accessable.

Any thoughts on how to do this?

-Shade

I am more than comfortable using one of my starter tickets if needed.

dhigbee
2003-09-25, 23:09 PM
Edit your httpd.conf file and change the path.

Don

dhigbee
2003-09-25, 23:09 PM
Oh, and restart Apache too.


Don

Shade
2003-09-26, 08:47 AM
BUWAHAHAHA! That's it! It's in the virtual host section! Thank you!!!!

-Shade

Shade
2003-09-26, 17:43 PM
Update:

I hope you guys don't mind me using the forums as my little notepad

I broke Apache. Quite easily actually, I was working inside the httpd.conf file and had to restart the server - well, I don't know what set it off, but Apache wouldn't restart. Even after a restart of the server.

<b>Sep 23 19:22:55 server1 httpd: httpd startup succeeded httpd has failed, please contact the sysadmin. </b>

Well, needless to say, I'm flipping out... But actually, it was quite easy to fix...

As root (of course) I noticed that there's two files...

httpd.conf
and
httpd.conf-

I checked out httpd.conf- and low and behold, it's a backup - pre-modding!!! Well, this is easy enough to fix.

# cp httpd.conf-
# mv /
# del httpd.conf
# cp /httpd.conf- /usr/local/apache/conf/httpd.conf

w00t w00t

-Shade

Shade
2003-09-26, 19:15 PM
Ugh. Okay guys... I need a crash course in httpd.conf editing.

I need to do the following:

LoadModule mime_module
LoadModule autoindex_module
LoadModule dir_module

Whenever I try to add the Modules needed, I can never restart Apache. My currently standing modules are as follows:

LoadModule rewrite_module libexec/mod_rewrite.so
LoadModule php4_module libexec/libphp4.so
LoadModule bwlimited_module libexec/mod_bwlimited.so
LoadModule bytes_log_module libexec/mod_log_bytes.so
LoadModule auth_passthrough_module

However, then I need to go into the addmodules - which looks like this:

# Reconstruction of the complete module list from all available modules
# (static and shared ones) to achieve correct module execution order.
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
AddModule mod_userdir.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_so.c
AddModule mod_setenvif.c
< IfDefine SSL >
AddModule mod_ssl.c
< /IfDefine >
AddModule mod_frontpage.c
AddModule mod_php4.c
AddModule mod_bwlimited.c
AddModule mod_log_bytes.c
AddModule mod_auth_passthrough.c

This is my first time doing any modular work - so if I could get some help? It'd be most definately appreciated...

oh, and if needed:


< VirtualHost 69.44.58.202 >
ServerAlias www.taintedjournal.com taintedjournal.com
ServerAdmin webmaster@taintedutopia.com
DocumentRoot /home/lj/htdocs
BytesLog domlogs/taintedjournal.com-bytes_log
ServerName www.taintedjournal.com
User lj
Group lj
CustomLog domlogs/taintedjournal.com combined
ScriptAlias /cgi-bin/ /home/lj/public_html/cgi-bin/
< /VirtualHost >

Thoughts? Suggestions? Death threats?

-Shade

dhigbee
2003-09-26, 20:18 PM
I am no expert, but I learn what I need to know. My first suggestion is for you to read the apache documentation for the complete understanding of how modules are loaded and in what order. Yes, there is an order.

Choose the documentation for your version of Apache on this page. (http://httpd.apache.org/)

As you make any changes to your httpd.conf file, you should run a config test to make sure there are no errors before restarting the server:

SSH
su
/etc/rc.d/init.d/httpd configtest
(or your path to your httpd start command, should be the same.)

This will allow you to test before doing any damage. Should also tell you what is wrong.

Here is a copy of one entry on my server for a virtual domain (names have been changed to protect the inocent), it may help you. Change the CAPS to your information.

<VirtualHost YOUR.IP.ADD.RESS:80>
ServerName DOMAIN.com
ServerAlias www.DOMAIN.com
UseCanonicalName Off
User USERNAME
Group GROUP
ServerAdmin "YOUR@ADDRESS.COM"
DocumentRoot /home/httpd/YOUR/PATH/httpdocs
CustomLog /home/httpd/YOUR/PATH/statistics/logs/access_log combined
ErrorLog /home/httpd/YOUR/PATH/statistics/logs/error_log
<IfModule mod_userdir.c>
UserDir /home/httpd/YOUR/PATH/web_users
</IfModule>
ScriptAlias /cgi-bin/ /home/httpd/YOUR/PATH/cgi-bin/
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /home/httpd/YOUR/PATH/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl)>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<Files ~ (\.asp)>
SetHandler perl-script
PerlHandler Apache::ASP
PerlSetVar Global /tmp
</Files>
<IfModule mod_php4.c>
php_admin_flag engine on
php_admin_value open_basedir "/home/httpd/YOUR/PATH/httpdocs:/tmp"
</IfModule>
<IfModule mod_python.c>
<Files ~ (\.py)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
Options +Includes +ExecCGI
</Directory>
Alias "/error_docs" "/home/httpd/YOUR/PATH/error_docs"
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
</VirtualHost>


Don

altp
2003-09-26, 20:57 PM
What error does it give in the log file?

/var/log/httpd is where it will be at. If apache doesn't start, its fairly good at giving you a starting place to look for problems.

Altp.

Shade
2003-09-27, 16:39 PM
Gentlemen, I appreciate ALL your help, very much... Due to working most of the night, I have been able to fix most of my issues and now am almost fully operational.

However, I now have one last problem before I should be able to go...

I have changed the directory that the site is placed in from:

/home/username/public_html
to
/home/username/htdocs

However, I have one small problem.

When I ftp, I can upload that domains public_html folder just fine, no problems there... So I change the path that I'm accessing and try to upload a file... But I get a permission error (550) that won't allow me to upload - it's like it's read only...

How would I fix this? I poked around in most that I could think of to no avail. Any thoughts?

-Shade