0

I want to redirect my trafic from my subdomain i.e blog.somesite.com to port i.e somesite.com:3000 using Virtual Host. My default Virtual Host configuration was:

<VirtualHost *:80>        

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/somesite.com/httpdocs/        

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Changes I made:

<VirtualHost somesite.com:80>        

            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/somesite.com/httpdocs/        

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

<VirtualHost blog.somesite.com:80>
    ServerName  blog.somesite.com
    ServerAlias www.blog.somesite.com

    ProxyPass /  http://somesite.com:3000/
    ProxyPassReverse / http://somesite.com:3000/


</VirtualHost>

By doing so my site goes down. What am I doing wrong here?

1

You cannot enter DNS names in "VirtualHost". Try the following:

<VirtualHost *:80>        
        ServerName somesite.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/somesite.com/httpdocs/        

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerName blog.somesite.com
    ServerAlias www.blog.somesite.com

    ProxyPass /  http://somesite.com:3000/
    ProxyPassReverse / http://somesite.com:3000/
</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.