我是靠谱客的博主 冷静发带,最近开发中收集的这篇文章主要介绍java web 服务器_搭建Java Web服务器运行环境,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

自己做了个网站,买了个Vps,需要自己搭建web环境,捣鼓了下,先简单的做个记录,后期会不断更新完善!

1,jdk 安装

wget http://download.oracle.com/otn-pub/java/jdk/last-version

tar zxvf jdk-7u9-linux-i586.tar.gz -C /usr/local

vi /etc/profile

export JAVA_HOME=/usr/local/jdk7#这里写jdk安装目录

export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

2, resin 安装

wget http://www.caucho.com/download/resin-pro-4.0.36.tar.gz

tar zxvf resin-pro-4.0.36.tar.gz -C /usr/local

yum install -y gcc make

cd /usr/local/resin-pro-4.0.36

./configure --prefix=/usr/local/resin

make && make install

cp -r /usr/local/resin-pro-4.0.36/init.d/resin /etc/init.d/resin

chmod +x /etc/init.d/resin

chkconfig --add resin

chkconfig --level 2345 resin on

service resin start/stop/restart

3, nginx 安装

wget http://ftp.exim.llorien.org/pcre/pcre-8.32.zip

yum install -y zip unzip

unzip pcre-8.32 -O /usr/local

wget http://zlib.net/zlib-1.2.8.tar.gz

tar zxvf zlib-1.2.8.tar.gz -C /usr/local

groupadd www

useradd -s /sbin/nologin -g www www -M www

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=/usr/local/pcre-8.32 --with-zlib=/usr/local/zlib-1.2.8

make && make install

nginx path prefix: "/usr/local/nginx"

nginx binary file: "/usr/local/nginx/sbin/nginx"

nginx configuration prefix: "/usr/local/nginx/conf"

nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

nginx pid file: "/usr/local/nginx/logs/nginx.pid"

nginx error log file: "/usr/local/nginx/logs/error.log"

nginx http access log file: "/usr/local/nginx/logs/access.log"

nginx http client request body temporary files: "client_body_temp"

nginx http proxy temporary files: "proxy_temp"

nginx http fastcgi temporary files: "fastcgi_temp"

nginx http uwsgi temporary files: "uwsgi_temp"

nginx http scgi temporary files: "scgi_temp"

/usr/local/nginx/sbin/nginx -h #帮助

/usr/local/nginx/sbin/nginx -v #显示版本

/usr/local/nginx/sbin/nginx -V #显示版本和配置信息

/usr/local/nginx/sbin/nginx -t #测试配置

/usr/local/nginx/sbin/nginx -q #测试配置时,只输出错误信息

/usr/local/nginx/sbin/nginx -s stop #停止服务器

/usr/local/nginx/sbin/nginx -s reload #重新加载配置

/usr/local/nginx/sbin/nginx -s quit #不知道,估计和stop差不多

/usr/local/nginx/sbin/nginx -s reopen #不知道,估计和reload类似

/usr/local/nginx/sbin/nginx -p /nginx/path #默认为/usr/local/nginx(nginx安装路径),修改后影响log目录和html目录

/usr/local/nginx/sbin/nginx -c /configure/file/path #配置文件路径,默认为conf/nginx.conf,有多个配置文件时很有用,用这个可以启动多个不同的nginx监听不同端口

/usr/local/nginx/sbin/nginx -g

wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.70.tar.gz

tar zxvf mysql-5.1.70.tar.gz -C /usr/local

groupadd mysql

useradd -s /sbin/nologin -g mysql mysql -M

cd /usr/local

tar zxvf /path/mysql-5.1.70.tar.gz

./configure

--prefix=/usr/local/mysql

--localstatedir=/data/mysql

--enable-assembler

--with-plugins=innobase,partition

--with-extra-charsets=gbk,gb2312,utf8

--enable-thread-safe-client

--with-client-ldflags=-all-static

--with-mysqld-ldflags=-all-static

--enable-local-infile

--with-pthread

make && make install

cp support-files/my-medium.cnf /etc/my.cnf

vi /etc/my.cnf #在mysqld里面加入 datadir = /data/mysql

cp support-files/mysql.server /etc/init.d/mysql

chmod 755 /etc/init.d/mysql

chkconfig --level 2345 mysql on

rm /data/mysql/mysql-bin.index

cd ../mysql

chown -R root:mysql .

bin/mysql_install_db --user=mysql --datadir=/data/mysql --defaults-file=/etc/my.cnf

chown -R mysql:mysql /data/mysql

service mysql start

mysql -uroot

use mysql

update user set user='centos',password=password('centos') where user='root';

select Host,User,Password,Select_priv,Grant_priv from user;

delete from user where user='';

delete from user where password='';

delete from user where host='';

drop database test;

grant select,insert,update,delete on ytyl.* to youtuyouliao@localhost identified by "youtuyouliaopwd";

flush privileges;

最后

以上就是冷静发带为你收集整理的java web 服务器_搭建Java Web服务器运行环境的全部内容,希望文章能够帮你解决java web 服务器_搭建Java Web服务器运行环境所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部