tomcat+nginx+mysql+jdk 环境搭建

1、安装JDK 

zrsz 上传到服务器安装 jdk 7u55

2、安装tomcat

下载tomcat 7 

3、安装nginx

nginx 安装依赖一下三个包

3.1  openssl-1.0.1c.tar.gz  

3.2  pcre-8.36.tar.gz  

3.3  zlib-1.2.8.tar.gz

3.4  yum install mhash

3.5  ./configure   /configure --prefix=/usr/local/nginx/  --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/nginx/soft/openssl-1.0.1c (指定openssl 库的路径) --with-pcre=../soft/pcre-8.21 --with-zlib=../soft/zlib-1.2.8

groupadd -r nginx
useradd -r -g nginx -s /bin/false -M nginx

#注意 \ 前面至少一个有空格
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.21 \  #指向解压的源码目录
--with-zlib=../zlib-1.2.8 \    #指向解压的源码目录
--with-openssl=../openssl-1.0.1 \ #指向解压的源码目录
--with-http_stub_status_module \#启用 nginx 的 NginxStatus 功能,用来监控 Nginx 的当前状态
--user=nginx --group=nginx

make && make install 

3.6 启动nginx  服务   /usr/local/nginx/nginx/sbin/nginx -c /usr/loacl/nginx/nginx/conf/nginx.conf (/usr/local/nginx/nginx 是nginx的安装目录)

  重新加载nginx 服务 /usr/local/nginx/nginx/sbin/nginx -s reload 

  ------------------------------------------------------------------------------------

  

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/local/tomcat/apache-tomcat-7.0.59/webapps/ROOT;(tomcat web存放文件夹)
index index.html index.htm index.jsp;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
location ~ \.jsp$ {
proxy_pass http://127.0.0.1:8080;(nginx 代理tomcat 8080 端口)

}

---------------------------------------------------------------

 

   /usr/local/nginx/sbin/nginx -t  检查 nginx.conf 配置文件是否正确

 

4、安装mysql

 安装rpm Mysql-server 5.5 ; Mysql-client 5.5

/etc/init.d/mysql start (启动mysql)

 

/usr/bin/mysqladmin -u root   password ‘create password‘ 创建root 密码

/usr/bin/mysqladmin -u root  -p ‘old password‘ password ‘create new password‘ 更改新密码;

mysql 数据库初始化  mysql_install_db

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。