javaweb + tomcat + deployment + domain name binding + default home page

 

①: Package the javaweb project into a war (not Baidu)

 

②: Copy the war to the webapps in the tomcat of the server

 

③: Go to the .bat file in the bin folder to start tomcat, and the war package will be decompressed after startup

 

⑤: After unzipping, you will get a folder with the same name as your war under webapps (this folder is your project)

 

⑥: Go to the web.xml under the WEB-INF folder of your project, add a <welcome-file> node between the <welcome-file-list> nodes, this is your default home page, such as <welcome-file> >index.jsp<welcome-file>

  It should be noted here that if your index.jsp is not placed under the webRoot, that is, the root site, but under a subfolder in the webRoot (for example: there is an Index folder under the webRoot, in the Index folder have

  index.jsp), then please note that <welcome-file>index.jsp<welcome-file> should be changed to <welcome-file>Index/index.jsp<welcome-file>.

 

⑦: We not only need to add a <welcome-file>Index/index.jsp<welcome-file> to the web.xml under the WEB-INF folder. The web.xml in the conf in the tomcat directory should also be added. Open web.xml and find <welcome-file-list> in it, then add <welcome-file>Index/index.jsp<welcome-file>. That's it. This is exactly the same as step 6

 

 

⑧: In the server.xml in the tomcat directory, find the <Connector> node, and change the port="8080" in it to "80". Find the <host> node and change its name="localhost" to your domain name, such as www.aa.com. Then in the host node, add a child node, the content is: <Context path="" docBase="E:/Server/apache-tomcat-7.0.78/webapps/Yellow" reloadable="true" />, put Change the path in docBase to the direct path of your project, such as this sentence E:/Server/apache-tomcat-7.0.78/webapps/Yellow, my project is named Yellow.

 

⑨: When you use a page as the home page (just like we use index.jsp as the home page), the content path of index.jsp will be affected (only this page will be affected, other pages will not). What will be affected. For example, in this page I imported a style, such as <link type="text\css" href="css/mian.css">, the path of this style will change, we need to change its path to Index/css /mian.css. Note that our directory structure is: there is a css folder under the Index folder, which contains styles, an img folder for pictures, and then there is an index.jsp in the Index folder. (If the understanding is vague, just change the path and test it.) Not only the css style is imported, but also other pictures and the like should be changed.

 

Finally: remember to open port 80 (some firewalls will close it). If port 80 is open, but it appears to be occupied, please see my other note on port 80 being occupied

 

Original reference: https://www.cnblogs.com/NJM-F/p/7097019.html?utm_source=itdadao&utm_medium=referral

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326466225&siteId=291194637