============ Webservers ============ => Server is a software which is used to run web applications. => Users can access our web application by sending request to server. => Users will use client s/w to send request to server Ex: Browser (google chrome, Firefox, Edge) => Server is responsible to handle user requests & response. => We have several servers in the market to run our web applications. 1) Tomcat 2) JBoss 3) Glassfish 4) WebLogic 5) WebSphere 6) IIS etc.. Note: To run web application, server is mandatory. => The process of executing web application by using server is called as Deployment. ============================ What is Build & Deployment ============================ Build = compile + test + package Deployment = Execution in server ============== Tomcat Server ============== => Tomcat is free & open source s/w => Tomcat is a web server developed by Apache Organization. => Tomcat server developed using Java language Note: To run tomcat server, java should be installed. => Tomcat server is used to run Java Web Applications. => Tomcat supports multiple operating systems. => Tomcat server runs on 8080 port number (we can change it). ======================= Tomcat Setup In Linux ======================= => Create Linux VM using Amazon Linux AMI in AWS Cloud => Connect to Linux VM using ssh client => Install maven software ex: sudo yum install maven Note: When we install maven, java s/w also gets installed automatically. mvn -version java -version => We can download tomcat software from its offical website URL : https://tomcat.apache.org/download-90.cgi => Download tomcat server zip file Ex: wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.96/bin/apache-tomcat-9.0.96.zip => Extract zip file Ex: unzip => Go inside tomcat directory and see directory structure cd ll =================================== Tomcat Server directory structure =================================== 1) bin : It contains files to start & stop server (windows : bat , Linux : sh) windows: startup.bat & shutdown.bat Linux : statup.sh & shutdown.sh 2) conf : It contains tomcat server configuration files. ex: server.xml, tomcat-users.xml 3) webapps : It is called as deployment folder. We will keep war files here for execution. 4) lib : It contains libraries required for server (jars). 5) temp : Temporary files will be created here (We can delete them). 6) logs : Server log messages will be stored here. ============================ Web app deployment process ============================ ## Step-1 :: Create Maven web application in ec2-user home directory ## mvn archetype:generate -DgroupId=in.ashokit -DartifactId=my-web-app -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.4 -DinteractiveMode=false cd ls -l ## Step-2 :: Build project using maven goal ## mvn clean package ls -l ls -l target cd .. ## Step-3 :: Copy application war file into tomact-server webapps folder for execution ## cp ## Step-4 :: Start tomcat server from bin directory ## cd apache-dir/bin ls -l chmod 777 catalina.sh chmod 777 startup.sh sh startup.sh ## Step-5 :: Enable Tomcat server port number 8080 in Ec2 VM Security Group Inbound Rules. ## Step-6 :: Access our web application using browser URL : http://public-ip:8080/my-web-app/