Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Server Creation</title>
  5. <link href='https://fonts.googleapis.com/css?family=Abel' rel='stylesheet'>
  6. <style type="text/css">
  7. body{
  8. font-family:Abel;
  9. }
  10. .back{
  11. padding-left:1vw;
  12. font-size:1.5vw;
  13. text-decoration:none;
  14. }
  15. .top{
  16. background-color:#eee;
  17. padding-bottom:1vw;
  18. }
  19. .nume{
  20. text-decoration:underline;
  21. font-size:2vw;
  22. padding-left:1vw;
  23. padding-top:1vw;
  24. }
  25. .autor{
  26. font-size:1vw;
  27. padding-left:3vw;
  28. padding-top:0.1vw;
  29. }
  30. .content{
  31. padding-left:2vw;
  32. font-size:1.1vw;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <a href="../web.php" class="back"> &larr; Back</a>
  38. <div class="top">
  39. <div class="nume">
  40. Server creation
  41. </div>
  42. <div class="autor">
  43. by: Catalin
  44. </div>
  45. </div>
  46. <div class="content">
  47. <h3>Introduction</h3>
  48. 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!
  49. <h3>Downloading the software</h3>
  50. 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.
  51. <br>
  52. <br>
  53. <img src="../../images/tomcat_d.png">
  54. <br>
  55. <h3>Setting up the server</h3>
  56. 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>
  57. 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.
  58. <br>
  59. <br>
  60. <img src="../../images/setup_tomcat.png">
  61. <br>
  62. <img src="../../images/setup_tomcat2.png">
  63. <br>
  64. <br>
  65. Now, open that file and write this line at the top:<br>
  66. Windows: <i>set "JRE_HOME=<b>your-java-path</b>"</i>
  67. <br>
  68. Linux: </i>export JAVA_HOME=<b>your-java-path</b></i>
  69. <br><br>
  70. <b>Important: the path should be to your /bin folder in your Java jre folder!</b>
  71. <br><br>
  72. It should now look like this:<br><br>
  73. <img src="../../images/setup_tomcat3.png">
  74. <h3>Your first web application</h3>
  75. Now, go into the webapps folder and create a new folder (name it after how you would like your application to be named).<br>
  76. Inside that folder create the file <b>index.html</b> and in it write "Hello world!"<br><br>
  77.  
  78. <img src="../../images/setup_tomcat4.png">
  79. <br><br>By default, the start page of a web application is the index.html file.<br><br>
  80. Now, we want to test the server! Run the startup.bat(linux: startup.sh)
  81.  
  82. <br>
  83. Next, in your browser go to <i>localhost:8080/your-app-name</i>.
  84. If everything went good, it should look like this:<br><br>
  85. <img src="../../images/setup_tomcat5.png">
  86.  
  87. <br><br>
  88. Great job! Now you have your own server running on your PC!
  89.  
  90. <h3>Acces your webapp from your mobile phone</h3>
  91. In order to access the webapp, we first need to find the IP of the machine that it is running on.<br>
  92. This machine needs to be on the same wifi network as the mobile phone that we want to access it with.<br>
  93. For this, open a <b>command prompt</b> in Windows(<b>terminal</b> in Linux,default shortcut Ctrl + Alt + T) and write:<br><br>
  94. Windows: <i>ipconfig</i><br>
  95. Linux: <i>ifconfig</i><br><br>
  96. We want to find the IPv4 address of the Wireless/LAN:
  97. <br>
  98. <img src="../../images/setup_tomcat6.png">
  99. <br>
  100. <br>
  101.  
  102. Now, go on your mobile phone's browser, and type in the address that you want to visit:<br><br>
  103.  
  104. <i><b>your-IPv4-adress:8080/your-app-name</b></i>
  105.  
  106. <br><br>
  107. 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>
  108. 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.
  109.  
  110. </div>
  111. <a href="../web.php" class="back"> &larr; Back</a>
  112. </body>
  113. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement