Linux JDK Tomcat Nginx MariaDB 安装,Nginx 多域名转发配置

安装JDK
rpm包下载地址(jdk-7u17 ):
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u17-oth-JPR

# yum install wget -y
JDK下载地址:
http://download.oracle.com/otn/java/jdk/7u17-b02/jdk-7u17-linux-x64.rpm?AuthParam=1494054963_ab211bdbaa89415192ec41e794dcf52e (有可能会过期,过期完以后需要重新登录)

安装:
# rpm -ivh jdk-7u17-linux-x64.rpm

配置Java Home
# vim ~/.bash_profile
写入:
PATH=$PATH:$HOME/bin
export JAVA_HOME=/usr/java/jdk1.7.0_17
PATH=$PATH:$JAVA_HOME/bin
export PATH
保存: shift+zz

刷新配置文件
# source ~/.bash_profile

查看JDK版本
# java -version
# javac -version

MariaDB Yum安装:

帮助文档:http://www.linuxidc.com/Linux/2016-03/128880.htm
下载地址:https://downloads.mariadb.org/mariadb/10.1.13/

# wget
http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-10.1.13/bintar-linux-x86_64/mariadb-10.1.13-linux-x86_64.tar.gz

# tar zxvf  mariadb-10.1.13-linux-x86_64.tar.gz   
# mv mariadb-10.1.13-linux-x86_64 /usr/local/mysql
# groupadd mysql                     增加 mysql 属组 
# useradd -g mysql mysql     增加 mysql 用户 并归于mysql 属组 
# chown mysql:mysql -Rf  /usr/local/mysql     设置 mysql 目录的用户及用户组归属。 
# chmod +x -Rf /usr/local/mysql    赐予可执行权限 
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf     复制默认mysql配置 文件到/etc 目录
# cd /usr/local/mysql 
# /usr/local/mysql/scripts/mysql_install_db --user=mysql   初始化数据 库 
# cp  /usr/local/mysql/support-files/mysql.server    /etc/init.d/mysql   复制mysql服务程序 到系统 目录 
# chkconfig  mysql on   添加mysql 至系统服务并设置为开机启动

# service  mysql  start  启动mysql
#vim /etc/profile   编辑profile,将mysql的可执行路径加入系统PATH
export PATH=/usr/local/mysql/bin:$PATH 
#source /etc/profile  使PATH生效。
#mysqladmin -u root password '123456' 设定root账号及密码
#mysql -uroot -p  使用root用户登录mysql
[none]>use mysql  切换至mysql数据库。
[mysql]>select user,host,password from user; --查看系统权限
[mysql]>drop user ''@'localhost'; --删除不安全的账户
[mysql]>drop user root@'::1';
[mysql]>drop user root@127.0.0.1;
[mysql]>select user,host,password from user;  查看系统权限确保不安全的账户均被删除。

[mysql]>flush privileges;  --刷新权限

1)修改字符集为UTF8
#vi /etc/my.cnf
在[client]下面添加 default-character-set = utf8
在[mysqld]下面添加 character_set_server = utf8
修改完重启:#service  mysql  restart 

2)增加错误日志(实际操作的时候报错)
#vi /etc/my.cnf
在[mysqld]下面添加:
log-error = /usr/local/mysql/log/error.log
general-log-file = /usr/local/mysql/log/mysql.log
修改完重启:#service  mysql  restart 

3) 设置为不区分大小写,linux下默认会区分大小写。
#vi /etc/my.cnf
在[mysqld]下面添加:
lower_case_table_name=1
修改完重启:#service  mysql  restart  

4) 添加外部访问权限
[mysql]> grant all privileges on *.* to 'root'@'%' identified by '112233';  
[mysql]> flush privileges;

Nginx 安装:

帮助文档:http://www.runoob.com/linux/nginx-install-setup.html
下载
# wget http://nginx.org/download/nginx-1.13.0.tar.gz
# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

一、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
二、首先要安装 PCRE
PCRE 作用是让 Nginx 支持 Rewrite 功能。
1、下载 PCRE 安装包,下载地址: 

http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
# wget 
http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2、解压安装包:
# tar zxvf pcre-8.35.tar.gz
3、进入安装包目录
# cd pcre-8.35
4、编译安装 
# ./configure
# make && make install
5、查看pcre版本
# pcre-config --version
安装 Nginx
1、下载 Nginx,下载地址:http://nginx.org/download/nginx-1.13.0.tar.gz
# wget http://nginx.org/download/nginx-1.13.0.tar.gz
2、解压安装包
# tar zxvf nginx-1.6.2.tar.gz
3、进入安装包目录
# cd nginx-1.6.2
4、编译安装
# ./configure --prefix=/data/nginx-1.13.0 
--with-http_stub_status_module --with-http_ssl_module --with-pcre=/data/pcre-8.35
# make
# make install
5、查看nginx版本
# /data/nginx-1.13.0/sbin/nginx -v
到此,nginx安装完成。

启动 Nginx
Nginx 启动命令如下:
# /data/nginx-1.13.0/sbin/nginx

# /data/nginx-1.13.0/sbin/nginx -s reload            # 重新载入配置文件
# /data/nginx-1.13.0/sbin/nginx -s reopen            # 重启 Nginx
# /data/nginx-1.13.0/sbin/nginx -s stop              # 停止 Nginx

检查配置文件ngnix.conf的正确性命令:
# /data/nginx-1.13.0/sbin/nginx -t

Nginx 多个域名跳转设置:

帮助文档:https://zhidao.baidu.com/question/360295158564852412.html

# cd /data/nginx-1.13.0/conf
# cp nginx.conf nginx.conf_bak
# vim  nginx.conf

#user  nobody;
worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    #gzip  on;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    server {
        listen       80;
        server_name  www.aabbcc.com;
        location / {
            proxy_pass    http://127.0.0.1:8080/;
        }
    }
}

安装Tomcat
下载:
# wget  
http://apache.fayea.com/tomcat/tomcat-7/v7.0.77/bin/apache-tomcat-7.0.77.tar.gz

# mv apache-tomcat-7.0.77   /data/tomcat7-wechat
# cd /data/tomcat7-wechat/bin
# ./startup

 

posted @ 2017-05-06 17:36  Bodi  阅读(330)  评论(0编辑  收藏  举报