Search code examples
apacheubuntulinode

configuring URL mapping


I have a cloud hosting in Linode. This is my IP: 123.456.789.111

I have this config file /etc/apache2/sites-available/nunitocalzada.com.conf

# domain: example.com
# public: /var/www/nunitocalzada.com/public_html/

    <VirtualHost *:80>
      # Admin email, Server Name (domain name), and any aliases
      ServerAdmin webmaster@nunitocalzada.com
      ServerName  www.nunitocalzada.com
      ServerAlias nunitocalzada.com

      # Index file and Document Root (where the public files are located)
      DirectoryIndex index.html index.php
      DocumentRoot /var/www/nunitocalzada.com/public_html
      # Log file locations
      LogLevel warn
      ErrorLog  /var/www/nunitocalzada.com/log/error.log
      CustomLog /var/www/nunitocalzada.com/log/access.log combined
    </VirtualHost>

I also have a tomcat application in the same server as well. This is the URL of the application http://123.456.789.111:8080/myapp/

I would like to enter to the application in this domain www.nunitocalzada.com

so I've created this file /var/www/nunitocalzada.com/public_html/index.html :

<html><head><title>Nunito Calzada</title></head>
<frameset cols="*">
 <frame name="main" src="http://123.456.789.111:8080/myapp/" scrolling="auto" noresize>
 <noframes>
 <body>

 Your browser does not support frames

 </body>
 </noframes>
</frameset>
</html>

but I guess there is a better way to do this


Solution

  • The standard way to do this is via a reverse proxy, which avoids having to use the high port number in the the URL or in frames. There are about a trillion recipes on the web for using Apache w/ mod_proxy in front of Tomcat.