Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Server Creation</title>
- <link href='https://fonts.googleapis.com/css?family=Abel' rel='stylesheet'>
- <style type="text/css">
- body{
- font-family:Abel;
- }
- .back{
- padding-left:1vw;
- font-size:1.5vw;
- text-decoration:none;
- }
- .top{
- background-color:#eee;
- padding-bottom:1vw;
- }
- .nume{
- text-decoration:underline;
- font-size:2vw;
- padding-left:1vw;
- padding-top:1vw;
- }
- .autor{
- font-size:1vw;
- padding-left:3vw;
- padding-top:0.1vw;
- }
- .content{
- padding-left:2vw;
- font-size:1.1vw;
- }
- </style>
- </head>
- <body>
- <a href="../web.php" class="back"> ← Back</a>
- <div class="top">
- <div class="nume">
- Server creation
- </div>
- <div class="autor">
- by: Catalin
- </div>
- </div>
- <div class="content">
- <h3>Introduction</h3>
- Creating your own server will be a lot easier than you think. Because we will be running the server on your own device, you need no special equipment.<br> We will create a program that will handle requests from external devices and then test it!
- <h3>Downloading the software</h3>
- We need only 1 download for this. Head to <a href="https://tomcat.apache.org/download-80.cgi">Tomcat</a> and download the server according to your operating system. We will need the "<b>core</b>" (avoid the installer for now, get a <i>.zip</i>).<br> The file is really small (about 8MB), so there will be no problems involving space.
- <br>
- <br>
- <img src="../../images/tomcat_d.png">
- <br>
- <h3>Setting up the server</h3>
- Next, we want to setup the path to our Java folder on the server. If you don't have Java installed, get it <a href="https://java.com/en/download/">here</a>.<br>
- Go to your <b>bin</b> Tomcat folder and locate the startup.bat (startup.sh on Linux) file. Open it with notepad (right-click -> open with... -> notepad). Ideally, you want to use <a href="https://notepad-plus-plus.org/download/v7.5.6.html">notepad++</a> instead of notepad.
- <br>
- <br>
- <img src="../../images/setup_tomcat.png">
- <br>
- <img src="../../images/setup_tomcat2.png">
- <br>
- <br>
- Now, open that file and write this line at the top:<br>
- Windows: <i>set "JRE_HOME=<b>your-java-path</b>"</i>
- <br>
- Linux: </i>export JAVA_HOME=<b>your-java-path</b></i>
- <br><br>
- <b>Important: the path should be to your /bin folder in your Java jre folder!</b>
- <br><br>
- It should now look like this:<br><br>
- <img src="../../images/setup_tomcat3.png">
- <h3>Your first web application</h3>
- Now, go into the webapps folder and create a new folder (name it after how you would like your application to be named).<br>
- Inside that folder create the file <b>index.html</b> and in it write "Hello world!"<br><br>
- <img src="../../images/setup_tomcat4.png">
- <br><br>By default, the start page of a web application is the index.html file.<br><br>
- Now, we want to test the server! Run the startup.bat(linux: startup.sh)
- <br>
- Next, in your browser go to <i>localhost:8080/your-app-name</i>.
- If everything went good, it should look like this:<br><br>
- <img src="../../images/setup_tomcat5.png">
- <br><br>
- Great job! Now you have your own server running on your PC!
- <h3>Acces your webapp from your mobile phone</h3>
- In order to access the webapp, we first need to find the IP of the machine that it is running on.<br>
- This machine needs to be on the same wifi network as the mobile phone that we want to access it with.<br>
- For this, open a <b>command prompt</b> in Windows(<b>terminal</b> in Linux,default shortcut Ctrl + Alt + T) and write:<br><br>
- Windows: <i>ipconfig</i><br>
- Linux: <i>ifconfig</i><br><br>
- We want to find the IPv4 address of the Wireless/LAN:
- <br>
- <img src="../../images/setup_tomcat6.png">
- <br>
- <br>
- Now, go on your mobile phone's browser, and type in the address that you want to visit:<br><br>
- <i><b>your-IPv4-adress:8080/your-app-name</b></i>
- <br><br>
- And here we go! Your first web application, that you can acces from other devices aswell!<br><font color="red">If you have problems connecting from your phone, try disabling the firewall on your PC.</font><br><br>
- Note! If you want your app to be accessible from the entire web, that is another topic.<br>It involes making your entire PC visible to anyone on the web.
- </div>
- <a href="../web.php" class="back"> ← Back</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement