Most other online tutorials herein by reference, after the actual operation back to some of the summary, I hope you can help you are deploying the project.
Basic environment: Centos7, tomcat8, jdk8, MySQL5.6, nginx
Install the JDK
1 |
yum install java-1.8.0-openjdk* -y |
Use yum to install, no need to configure the system environment, execute this command after completion of the JDK installed.
Mysql installation
Here we use Mysql, if you are using MariaDB, general cloud server has installed, you can only upgrade.
installation steps:
1 2 3 |
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install mysql-community-server |
Mysql restart the service:
1 |
# service mysqld restart |
After the restart, we use the following command into the MySQL, MySQL because there is no password by default.
1 |
# mysql -u root |
Into MySQL, we use the following MySQL
1 |
set password for 'root'@'localhost' =password('password'); |
At this point, MySQL database basic installation is complete, sometimes the development process, for convenience, want the database to connect through a local line visualization tools remotely, then you can run the following command to open a remote connection to the database.
1 |
grant all privileges on *.* to root@'%'identified by 'password'; |
Tomcat installation
tomcat deployment of the most simple:
1, and then downloaded directly onto the linux / home folder (download version below) below;
2, by Xftp packaged good war drag and drop files to the webapps folder, and this operation no difference in the windows, which some details do not say;
3, start the tomcat server command:
1 2 3 |
cd /home/apache-tomcat-8.5.23/bin nohup ./startup.sh & |
Stop Services Directive:
1 |
./ shutdown.sh |
Execution trace log command
1 2 3 |
cd /home/apache-tomcat-8.5.23/logs tail -100f catalina.out |
If you want to modify the port, you can use the following commands to enter server.xml.
1 2 3 |
cd /home/apache-tomcat-8.5.23/conf we server.xml |
Into the editor to modify After editing click esc, and then enter: wq thus saving quit. After the restart tomcat, the configuration will take effect.
Nginx do use a proxy server
1, install gcc g ++ class library development
Installation make:
1 |
yum -y install gcc automake autoconf libtool make |
Install g ++:
1 |
yum install gcc gcc-c++ |
2, the selected installation directory
You can select any directory, select cd / usr / local / src
1 |
cd /usr/local/src |
3, install the PCRE library
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ download the latest PCRE source package, use the following command to download and install PCRE compiled packages:
1 2 3 4 5 6 7 |
cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.37.tar.gz cd pcre-8.34 ./configure make make install |
4, install zlib library
http://zlib.net/zlib-1.2.11.tar.gz 下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:
1 2 3 4 5 6 7 8 |
cd /usr/local/src wget http://zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make make install |
5、安装openssl(某些vps默认没装ssl)
1 2 3 |
cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz |
6、安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:
1 2 3 4 5 6 7 |
cd /usr/local/src wget http://nginx.org/download/nginx-1.1.10.tar.gz tar -zxvf nginx-1.1.10.tar.gz cd nginx-1.1.10 ./configure make make install |
7、配置nginx
因为可能apeache占用80端口,apeache端口尽量不要修改,我们选择修改nginx端口。
linux 修改路径/usr/local/nginx/conf/nginx.conf,Windows 下 安装目录\conf\nginx.conf。
修改端口为8090,localhost修改为你服务器ip地址。
8、nginx重启、关闭、启动
启动
启动代码格式:nginx安装目录地址 -c nginx配置文件地址
例如:
1 |
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf |
停止
1、查看进程号
1 |
[root@LinuxServer ~]# ps -ef|grep nginx |
找到nginx master端口
2、杀死进程
1 |
[root@LinuxServer ~]# kill -QUIT 2072 |
重启
1、验证nginx配置文件是否正确
方法一:进入nginx安装目录sbin下,输入命令./nginx -t
看到如下显示nginx.conf syntax is ok
nginx.conf test is successful
说明配置文件正确!
Nginx配置正确,我们可以执行重启Nginx命令了,方法是进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可。