Configure httpd.conf to add new site on Apache Red Hat Linux -
i have linux server (red hat enterprise linux server release 5.3 (tikanga)) apache installed. used browsing documents. add new directory (with html page), whenever directory browsed can display html page.
but not sure of edit httpd.conf file
existing httpd.conf:
when hit url "http://servername/eng" displays list of folders.
now, want add website existing, when user hit url "http://servername/builds" should display html page in browser.i have added "index.html" page in location "/var/www/html/builds/"
for added below code httpd.conf file
please let me know modifications required in conf file
you can in few different ways.
putting
index.html
in/build
this requires have setting:
directoryindex index.html
(it should there default on platform.)
also work, rather putting new
<directory>
, should putbuild/
directory in directory holdshttp://example.com/
files. instance:/var/www/example.com/public_html/eng/ /var/www/example.com/public_html/builds/ /var/www/example.com/public_html/builds/index.html
storing
build/
in folder unrelatedexample.com
, still able reach viaexample.com/builds
for this, need rewrite urls
example.com/builds
redirects user final url. achieved through mod_rewrite. enablemod_rewrite
module in apache's configuration, make sureexample.com
can have.htaccess
files through ensuring properallowoverride
entry inexample.com
's<directory>
configuration, create/var/www//example.com/public_html/.htaccess
(or similar) file, , fillrewriteengine on
,rewriterule
s need. more on mod_rewrite in internet , in documentation.completely separate virtual server, example
builds.example.com/
in case, you're looking virtual servers. these not defined in
httpd.conf
or configuration itself, have dedicated directory.for example, add
builds.example.com
works port 80, you'd need create following entry:<virtualhost *:80> servername builds.example.com documentroot /var/www/builds.example.com/public_html/ </virtualhost>
where put this? well, depends on platform. debian, put in new file in
/etc/apache2/sites-available/
, e.g./etc/apache2/sites-available/example.com
, , symlink in/etc/apache2/sites-available
(on debian, cana2ensite <name_of_file>
. on platform procedure might different, ("adding virtual servers on " start). after adding virtual servers, need reload apache configuration.
please let me know if satisfies question, if not, i'll edit answer accordingly.
Comments
Post a Comment