LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2016, 02:32 AM   #1
hruday
Member
 
Registered: Jun 2015
Posts: 88

Rep: Reputation: Disabled
setting DocumentRoot for only one virtual host in apache


This is my os configuration.
OS: CentOS 7
apache: 2.4.6

I need to set DocumentRoot for one of my project in VirtualHost keeping httpd.conf file as it is default.

Is my below configuration correct or do I need to change anything?

<VirtualHost ipaddress:80>
ServerAdmin sys@abc.com
ServerName xyz.com

DocumentRoot /home/myproject/newpro

<Directory "/home/myproject/newpro">
Order allow,deny
Allow from all
</Directory>

########FOR ERROR LOG AND ACCESS LOG#######################
ErrorLog /var/log/httpd/jilmore-error.log
CustomLog /var/log/httpd/jilmore-access.log common env=!dontlog

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

#Don't proxypass the static ui resources
ProxyPassMatch ^(/.*\.pdf|/.*\.php|/.*\.html|/.*\.js|/.*\.png|/.*\.css|/.*\.gif|/.*\.jpg|/.*\.ico|/.*\.json|/.*\.woff|/.*\.woff2|/.*\.ttf|/.*\.eot|/.*\.otf|/.*\.svg|/.*\.xml|/.*\.swf|/.*\.txt)$ !
############### PROXYPASS TO THE JBOSS INSTANCE #############
ProxyPass / http://localhost:10018/
ProxyPassReverse / http://localhost:10018/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>


I also have other virtualhosts configured with default DocumentRoot "/var/www/html".
But I need to change for only one domain.

Last edited by hruday; 03-30-2016 at 02:34 AM.
 
Old 03-30-2016, 04:08 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Your config is good.
Just for cosmetic reasons, as you use apache-2.4, you could replace:
Quote:
Order ...
Allow from all
with
Code:
Require all granted
Regards
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to tunnel apache virtual host to an internal apache? ciuly Linux - Server 5 01-31-2010 12:53 PM
Setting up a virtual host on apache for SagePay integration - advice for a novice! lauriedunsire Linux - Software 6 08-13-2009 04:36 AM
Apache 2.2 Two Virtual Hosts with same DocumentRoot problem Sysop1911 Linux - Server 1 05-26-2009 08:16 PM
Setting up apache virtual host in redhat linux chu2654 Linux - Server 4 02-28-2008 10:20 PM
Virtual Host conflict with DocumentRoot icejam Linux - Software 3 04-11-2006 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration