Learning notes: Aliyun ECS common problems and solutions for deploying Web projects __web

Source: Internet
Author: User
Tags pack aliyun
common problems and solutions for Aliyun ECS Deployment Web Project

Cloud Server ECS (Elastic Compute Service) is a flexible, scalable computing services that help you reduce IT costs, enhance operational efficiency, and make you more focused on core business innovations.
For the ECS configuration used, refer to the cloud-wing plan, operating system mirroring CentOS 7.3 64-bit (steps and considerations for replacing the system disk) first, use putty to connect to ECS via SSH disconnected

Enter the system through the console terminal and login to enter Vim/etc/ssh/sshd_config Open the Sshd_config file to move the cursor to the last line and press the I key. Change Passwordauthentication No to passwordauthentication Yes press ESC, enter: WQ input service sshd Restart Restart sshd Service two, install Tomcat

Unlike Apache and MySQL, CentOS's yum source does not include Tomcat, so you need to download it yourself. You can access the Tomcat website download on your local Windows system, and it is recommended that you download the previous version (or current version) of the current latest version. The download is completed and uploaded to the cloud server's/usr/local directory via FileZilla. Execute the following command in turn

Cd/usr/local    
TAR-ZXVF apache-tomcat-8.0.26.tar.gz/Decompression Compression pack    
RM-RF apache-tomcat-8.0.26.tar.gz.tar.gz//Delete compression pack    
MV apache-tomcat-8.0.26 Tomcat
Iii. How to access the projects deployed in Tomcat directly via IP (domain name)To configure the default project name
Open Tomcat/conf/server.xml and find
 

In the middle of <Host> and </Host> Plus
<context path= "" docbase= "[Tomcat directory]/webapps/[project name]"/>
Modified results:

 

Save exit
2. Configure 80 ports
Found in the Tomcat/conf/server.xml.

<connector port= "8080" protocol= "http/1.1
      " maxthreads= "The Minsparethreads=" maxsparethreads= "acceptcount="
      connectiontimeout= "20000" redirectport= "8443 
      "/>

Change port= "8080" to port= "80"
3. Configure Welcome-file
Open Web-inf/web.xml in a project
Welcome-file is the first page that is accessed by default if you want to set it to index.jsp
So just add <welcome-file>index.jsp</welcome-file> in <welcome-file-list> and </welcome-file-list> Can

All of this modification is complete. After you have deployed the project, you need to enter [ip]:8080/[project name] [filename] To access the file, modified only need to enter [IP] can four, mariadb and MySQL database

CentOS 7, MySQL is no longer included in the CentOS source, but instead of mariadb. MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, with the GPL license. One of the reasons for developing this branch is that Oracle has a potential risk of MySQL closed source after acquiring MySQL, so the community uses a branching approach to avoid the risk. MARIADB is designed to be completely compatible with MySQL, including APIs and command lines, making it easy to become a replacement for MySQL.

How to install MARIADB
Mariadb completely inherited the MySQL command, use is not much different, this recommendation CentOS 7 users to use MARIADB. The following three points need to be noted when using mariadb instead of MySQL: Download the mariadb driver package, put it into Tomcat and project's Lib directory, and change the database drive from "Com.mysql.jdbc.Driver" to " Org.mariadb.jdbc.Driver "The URL to establish a connection is changed from" Jdbc:mysql://localhost:3306/webstore "to" jdbc:mariadb://localhost:3306/ Webstore "

For more stories between MySQL and mariadb, ask interested readers to search for themselves, and don't dwell on it. v. Database Chinese issues

MySQL and mariadb are very unfriendly to Chinese, and the default encoding is latin1. If you want to write to Chinese, you need to change it to Utf-8
1. Log in to the database using Mysql-uroot-p
2. Execute show variables like ' character% '; The result is as follows

3. Modify the configuration file to perform VIM/ETC/MY.CNF
4. Add character-set-server = UTF8 under [mysqld] field (press I key to enter edit mode)
5. Save and exit (press Esc key, enter: WQ)
6. Restart the database service (systemctl restart mariadb) CentOS 7 replaced service command with systemctl command Six, firewall and security group

After you deploy Tomcat and MARIADB, you may not be able to access it externally, possibly because a firewall or security group setting causes the CentOS 7 default firewall firewall to be turned off

Systemctl Stop
firewalld.service 
#停止firewall
systemctl disable Firewalld.service 
#禁止firewall开机启动
firewall-cmd--state 
#查看默认防火墙状态 (show notrunning after closing, show running after opening)


Add 80-Port and 3306-port access to the security group. (How to Add.) )

A security group is a logical grouping that consists of instances of the same domain that have the same security requirements and trust each other. Security groups, such as firewalls, to set up a single or multiple cloud server network access control, it is an important means of security isolation. Each instance belongs to at least one security group and needs to be specified when it is created. The default intranet between instances of different security groups can authorize mutual visits between the two security groups. - -Shallow singing in university

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.