LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   setting DocumentRoot for only one virtual host in apache (https://www.linuxquestions.org/questions/linux-newbie-8/setting-documentroot-for-only-one-virtual-host-in-apache-4175576181/)

hruday 03-30-2016 02:32 AM

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.

bathory 03-30-2016 04:08 AM

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


All times are GMT -5. The time now is 02:20 AM.