Linux(centos 7)配置tomcat8、JDK1.8、lighttpd、ngnix、mysql
JDK
下载好后使用 rpm -ivh jdk-7u25-linux-x64.rpm 进行安装。
安装好后编辑 /etc/profile 文件,在末尾加上:
1 2 3 |
export JAVA_HOME="/usr/java/jdk1.7.0_25" export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin |
然后保存退出,接着使用以下命令让环境变量生效:
Shell
1 |
source /etc/profile |
最后执行 javac 命令以检查是否正确配置。
centos7下tomcat7 或tomcat8启动超慢原因
1,找到你的jdk安装的位置
[html] view plain copy
- ${JAVA_HOME}/jre/lib/security/java.security
2,vi 打开后找到
[html] view plain copy
- securerandom.source=file:/dev/urandom
修改
[html] view plain copy
- securerandom.source=file:/dev/./urandom
3,重新启动tomcat就好了
Reference-link:
http://www.cnblogs.com/suiyueqiannian/p/6060951.html?utm_source=itdadao&utm_medium=referral
Tomcat
下载好安装包,解压到/home/apache-tomcat-7.0.67下
(解压
tar –xvf file.tar //解压 tar包
tar -xzvf file.tar.gz //解压tar.gz
tar -xjvf file.tar.bz2 //解压 tar.bz2
tar –xZvf file.tar.Z //解压tar.Z
unrar e file.rar //解压rar
unzip file.zip //解压zip
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 进入Tomcat安装目录下的bin目录 cd /home/apache-tomcat-7.0.67/bin # 解压commons-daemon-native.tar.gz tar zxvf commons-daemon-native.tar.gz cd commons-daemon-1.0.15-native-src/unix # 这里需要gcc、make等编译工具,如果没有指定JAVA_HOME环境变量,则需要 --with-java= 参数指定jdk目录 ./configure Eg ./configure --with-java=/usr/java/jdk1.8.0_141 # 上一步成功后,make make # make后,会在当前文件夹下生成一个名为 js<a class="keylink" href="http://www.2cto.com/kf/ware/vc/" target="_blank">vc</a> 的文件,将其复制到$CATALINA_HOME/bin目录 cp jsvc ../../ # 添加一个用来运行Tomcat的用户 useradd tomcat -M -d / -s /usr/sbin/nologin # 回到$CATALINA_HOME/bin目录下 cd ../../ # 接下来便是修改$CATALINA_HOME/bin目录下的 daemon.sh 文件 # 设置其中的 TOMCAT_USER=tomcat JAVA_HOME=/usr/java/jdk1.7.0_79 # 如果$CATALINA_HOME/bin下的*.sh文件没有运行权限,则为其添加运行权限 chmod +x *.sh # 设置$CATALINE_HOME文件夹及其所有子文件Owner为tomcat chown -R tomcat:tomcat /home/apache-tomcat-7.0.67 # 启动Tomcat daemon.sh start ./daemon.sh start |
设置Tomcat为Service
1 2 3 4 5 6 7 |
# 创建 $CATALINA_HOME/bin/daemon.sh 的一个链接到 /etc/init.d/ 下,service名为tomcat7 ln -s /home/apache-tomcat-7.0.67/bin/daemon.sh /etc/init.d/tomcat7 # 启动Tomcat /etc/init.d/tomcat7 start # 或者 service tomcat7 start |
设置Tomcat开机自启动 (前提是已经设置Tomcat为Service)
1 2 3 4 5 |
# 设置开机自启动 update-rc.d tomcat7 defaults # 取消开机自启动 update-rc.d tomcat7 remove |
MySQL
[root@iZ28gvqe4biZ ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
获取http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-release-el7-5 ################################# [100%]
这个时候查看当前可用的mysql安装资源:
[root@iZ28gvqe4biZ ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 17
mysql-tools-community/x86_64 MySQL Tools Community 31
mysql56-community/x86_64 MySQL 5.6 Community Server 199
一般来说,只要安装mysql-server跟mysql-client
这个时候我们可以直接使用yum的方式安装MySQL了
[root@iZ28gvqe4biZ ~]# yum -y install mysql-community-server
已加载插件:langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.28-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.5.6.28-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-client-5.6.28-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.28-2.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.40-1.el7_0 将被 取代
---> 软件包 mysql-community-libs.x86_64.0.5.6.28-2.el7 将被 舍弃
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==============================================================================================
Package 架构 版本 源 大小
==============================================================================================
正在安装:
mysql-community-libs x86_64 5.6.28-2.el7 mysql56-community 2.0 M
替换 mariadb-libs.x86_64 1:5.5.40-1.el7_0
mysql-community-server x86_64 5.6.28-2.el7 mysql56-community 58 M
为依赖而安装:
mysql-community-client x86_64 5.6.28-2.el7 mysql56-community 19 M
mysql-community-common x86_64 5.6.28-2.el7 mysql56-community 256 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
事务概要
==============================================================================================
安装 2 软件包 (+8 依赖软件包)
总下载量:80 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.28-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
mysql-community-common-5.6.28-2.el7.x86_64.rpm 的公钥尚未安装
(1/10): mysql-community-common-5.6.28-2.el7.x86_64.rpm | 256 kB 00:00:14
(2/10): mysql-community-libs-5.6.28-2.el7.x86_64.rpm | 2.0 MB 00:02:57
(3/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(4/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(5/10): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(6/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(7/10): perl-PlRPC-0.2020-14.el7.noarch.rpm
(8/10): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(9/10): mysql-community-server-5.6.28-2.el7.x86_64.rpm | 58 MB 00:54:45
(10/10): mysql-community-client-5.6.28-2.el7.x86_64.rpm | 19 MB 00:20:42
总计 13 kB/s | 80 MB 01:45:50
从 file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
用户ID : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
软件包 : mysql-community-release-el7-5.noarch (installed)
来自 : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : mysql-community-common-5.6.28-2.el7.x86_64 1/11
正在安装 : mysql-community-libs-5.6.28-2.el7.x86_64 2/11
正在安装 : mysql-community-client-5.6.28-2.el7.x86_64 3/11
正在安装 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/11
正在安装 : perl-Net-Daemon-0.48-5.el7.noarch 5/11
正在安装 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/11
正在安装 : perl-IO-Compress-2.061-2.el7.noarch 7/11
正在安装 : perl-PlRPC-0.2020-14.el7.noarch 8/11
正在安装 : perl-DBI-1.627-4.el7.x86_64 9/11
正在安装 : mysql-community-server-5.6.28-2.el7.x86_64 10/11
正在删除 : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11
验证中 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/11
验证中 : perl-Net-Daemon-0.48-5.el7.noarch 2/11
验证中 : mysql-community-common-5.6.28-2.el7.x86_64 3/11
验证中 : perl-IO-Compress-2.061-2.el7.noarch 4/11
验证中 : mysql-community-libs-5.6.28-2.el7.x86_64 5/11
验证中 : mysql-community-client-5.6.28-2.el7.x86_64 6/11
验证中 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/11
验证中 : perl-DBI-1.627-4.el7.x86_64 8/11
验证中 : mysql-community-server-5.6.28-2.el7.x86_64 9/11
验证中 : perl-PlRPC-0.2020-14.el7.noarch 10/11
验证中 : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11
已安装:
mysql-community-libs.x86_64 0:5.6.28-2.el7 mysql-community-server.x86_64 0:5.6.28-2.el7
作为依赖被安装:
mysql-community-client.x86_64 0:5.6.28-2.el7 mysql-community-common.x86_64 0:5.6.28-2.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBI.x86_64 0:1.627-4.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
替代:
mariadb-libs.x86_64 1:5.5.40-1.el7_0
完毕!
安装完的配置
加入开机启动
[root@iZ28gvqe4biZ ~]# systemctl enable mysqld
启动mysql服务进程
[root@iZ28gvqe4biZ ~]# systemctl start mysqld
重置密码
[root@iZ28gvqe4biZ ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y [设置root用户密码]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y [删除匿名用户]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n [禁止root远程登录]
... skipping.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y [删除test数据库]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y [刷新权限]
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
1003错误 授权
在本机先使用root用户登录mysql: mysql -u root -p
"youpassword" 进行授权操作:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
重载授权表:
FLUSH PRIVILEGES;
退出mysql数据库:
exit
登录测试
[root@yl-web yl]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server
新建Hive知识库
//登录MYSQL(有ROOT权限)。这里我以ROOT身份登录
[root@iZ28gvqe4biZ ~]# mysql -u root -p
//首先为用户创建一个数据库hivemeta
mysql > create database hivemeta;
mysql > use hivemeta
//授权hdp用户拥有hivemeta数据库的所有权限。
mysql > grant all privileges on *.* to hdp@"%" identified by "hdp" with grant option;
//刷新系统权限表
mysql > flush privileges;
mysql > use hivemeta;
//mysql/hive字符集问题
mysql > alter database hivemeta character set latin1;
MYsql不区分 大小写
1、用root登录,修改 /etc/my.cnf;
2、在[mysqld]节点下,加入一行: lower_case_table_names=1
3、重启MySQL即可;
Service port服务器端口http://blog.csdn.net/l1028386804/article/details/50779761
Itables
/etc/sysconfig/iptables 内容
# Generated by iptables-save v1.4.7 on Fri Jan 22 16:43:05 2016
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 2228 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3128 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 3306 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 2228 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 3128 -j ACCEPT
COMMIT
# Completed on Fri Jan 22 16:43:05 2016
/etc/ssh/sshd_config
#Port 22
Port 2228
centos7 yum 方式安装nginx
(1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库
#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
(2)使用下面命令安装nginx
#yum install nginx
(3)启动Nginx
#service nginx start
或
#systemctl start nginx.service
systemctl stop nginx.service
systemctl restart lighttpd
Ngnix Server 配置
/etc/nginx/conf.d/com.zero4j.www.conf 内容
#https://www.youhuidongguan.com:443/的ssl配置
upstream backend {
server 127.0.0.1:8288;
#server 127.0.0.1:9682 backup;
#ip_hash;
}
server {
listen 443 ssl http2 default_server;
# listen [::]:443 ssl;
# server_name _;
server_name www.zero4j.com;
root /usr/share/nginx/html;
ssl_certificate ssl/www.zero4j.com.pem;
ssl_certificate_key ssl/www.zero4j.com.key;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://backend;
#Proxy Settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 64k;
}
}
Install Lighttpd
使用包管理器安装
这里我们通过使用包管理器这种最简单的方法来安装 Lighttpd。只需以 sudo 模式在终端或控制台中输入下面的指令即可。
CentOS 7
由于 CentOS 7.0 官方仓库中并没有提供 Lighttpd,所以我们需要在系统中安装额外的软件源 epel 仓库。使用下面的 yum 指令来安装 epel。
# yum install epel-release
然后,我们需要更新系统及为 Lighttpd 的安装做前置准备。
# yum update
# yum install lighttpd
开启服务
现在,通过执行 systemctl 指令来重启 Web 服务。
# systemctl start lighttpd
systemctl stop lighttpd
然后我们将它设置为伴随系统启动自动运行。
# systemctl enable lighttpd
Lighttpd http 跳转 https
/etc/lighttpd/lighttpd.conf 内容 下一节 /etc/lighttpd/modules.conf 内容
#######################################################################
##
## /etc/lighttpd/lighttpd.conf
##
## check /etc/lighttpd/conf.d/*.conf for the configuration of modules.
##
#######################################################################
#######################################################################
##
## Some Variable definition which will make chrooting easier.
##
## if you add a variable here. Add the corresponding variable in the
## chroot example aswell.
##
var.log_root = "/var/log/lighttpd"
var.server_root = "/srv/www"
var.state_dir = "/var/run"
var.home_dir = "/var/lib/lighttpd"
var.conf_dir = "/etc/lighttpd"
##
## run the server chrooted.
##
## This requires root permissions during startup.
##
## If you run Chrooted set the the variables to directories relative to
## the chroot dir.
##
## example chroot configuration:
##
#var.log_root = "/logs"
#var.server_root = "/"
#var.state_dir = "/run"
#var.home_dir = "/lib/lighttpd"
#var.vhosts_dir = "/vhosts"
#var.conf_dir = "/etc"
#
#server.chroot = "/srv/www"
##
## Some additional variables to make the configuration easier
##
##
## Base directory for all virtual hosts
##
## used in:
## conf.d/evhost.conf
## conf.d/simple_vhost.conf
## vhosts.d/vhosts.template
##
var.vhosts_dir = server_root + "/vhosts"
$SERVER["socket"] == ":80" {
#tomcat
$HTTP["host"] == "www.zero4j.com" {
url.redirect = ( "^/(.*)" => "https://www.zero4j.com/$1" )
}
}
#$SERVER["socket"] == ":443" {
#$HTTP["scheme"] == "https" {
#
# setenv.add-environment = (
# "HTTPS" => "on"
# )
# ssl.engine = "enable"
# #ssl.use-sslv2 = "disable"
# #ssl.use-sslv3 = "disable"
# #ssl.use-compression = "disable"
# ssl.pemfile = "/etc/lighttpd/ssl/sway.com.cn.pem"
#
# #ssl.verifyclient.activate = "enable"
# #ssl.verifyclient.depth = 1
# #ssl.ca-file = "/etc/lighttpd/ssl/sway.com.cn.crt"
#
# setenv.add-request-header = (
# "Host" => "request.com",
# "X-Real-IP" => "120.24.182.145",
# "X-Forwarded-For" => "some.real.ip.address",
# "X-Forwarded-Proto" => "https",
# "X-Forwarded-Protocol" => "https",
# "HTTP_X_FORWARDED_PROTO" => "https",
# "HTTP_X_FORWARDED_PROTOCOL" => "https",
# "HTTP_SCHEME " => "https",
# "scheme" => "https",
# ":scheme" => "https",
# )
#
# #setenv.add-response-header = ( "X-Frame-Options" => "DENY")
# setenv.add-response-header = ( "Strict-Transport-Security" => "max-age=63072000; includeSubdomains; preload")
#
# #ssl.cipher-list = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
# #ssl.honor-cipher-order = "enable"
# #ssl.disable-client-renegotiation = "enable"
#
# proxy.balance = "hash"
# proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9503 ) ) )
#
#}
##
## Cache for mod_compress
##
## used in:
## conf.d/compress.conf
##
var.cache_dir = "/var/cache/lighttpd"
##
## Base directory for sockets.
##
## used in:
## conf.d/fastcgi.conf
## conf.d/scgi.conf
##
var.socket_dir = home_dir + "/sockets"
##
#######################################################################
#######################################################################
##
## Load the modules.
include "modules.conf"
##
#######################################################################
#######################################################################
##
## Basic Configuration
## ---------------------
##
server.port = 80
##
## Use IPv6?
##
server.use-ipv6 = "disable"
##
## bind to a specific IP
##
#server.bind = "localhost"
##
## Run as a different username/groupname.
## This requires root permissions during startup.
##
server.username = "lighttpd"
server.groupname = "lighttpd"
##
## enable core files.
##
#server.core-files = "disable"
##
## Document root
##
server.document-root = server_root + "/lighttpd"
##
## The value for the "Server:" response field.
##
## It would be nice to keep it at "lighttpd".
##
#server.tag = "lighttpd"
##
## store a pid file
##
server.pid-file = state_dir + "/lighttpd.pid"
##
#######################################################################
#######################################################################
##
## Logging Options
## ------------------
##
## all logging options can be overwritten per vhost.
##
## Path to the error log file
##
server.errorlog = log_root + "/error.log"
##
## If you want to log to syslog you have to unset the
## server.errorlog setting and uncomment the next line.
##
#server.errorlog-use-syslog = "enable"
##
## Access log config
##
include "conf.d/access_log.conf"
##
## The debug options are moved into their own file.
## see conf.d/debug.conf for various options for request debugging.
##
include "conf.d/debug.conf"
##
#######################################################################
#######################################################################
##
## Tuning/Performance
## --------------------
##
## corresponding documentation:
## http://www.lighttpd.net/documentation/performance.html
##
## set the event-handler (read the performance section in the manual)
##
## possible options on linux are:
##
## select
## poll
## linux-sysepoll
##
## linux-sysepoll is recommended on kernel 2.6.
##
server.event-handler = "linux-sysepoll"
##
## The basic network interface for all platforms at the syscalls read()
## and write(). Every modern OS provides its own syscall to help network
## servers transfer files as fast as possible
##
## linux-sendfile - is recommended for small files.
## writev - is recommended for sending many large files
##
server.network-backend = "linux-sendfile"
##
## As lighttpd is a single-threaded server, its main resource limit is
## the number of file descriptors, which is set to 1024 by default (on
## most systems).
##
## If you are running a high-traffic site you might want to increase this
## limit by setting server.max-fds.
##
## Changing this setting requires root permissions on startup. see
## server.username/server.groupname.
##
## By default lighttpd would not change the operation system default.
## But setting it to 2048 is a better default for busy servers.
##
server.max-fds = 2048
##
## Stat() call caching.
##
## lighttpd can utilize FAM/Gamin to cache stat call.
##
## possible values are:
## disable, simple or fam.
##
server.stat-cache-engine = "simple"
##
## Fine tuning for the request handling
##
## max-connections == max-fds/2 (maybe /3)
## means the other file handles are used for fastcgi/files
##
server.max-connections = 1024
##
## How many seconds to keep a keep-alive connection open,
## until we consider it idle.
##
## Default: 5
##
#server.max-keep-alive-idle = 5
##
## How many keep-alive requests until closing the connection.
##
## Default: 16
##
#server.max-keep-alive-requests = 16
##
## Maximum size of a request in kilobytes.
## By default it is unlimited (0).
##
## Uploads to your server cant be larger than this value.
##
#server.max-request-size = 0
##
## Time to read from a socket before we consider it idle.
##
## Default: 60
##
#server.max-read-idle = 60
##
## Time to write to a socket before we consider it idle.
##
## Default: 360
##
#server.max-write-idle = 360
##
## Traffic Shaping
## -----------------
##
## see /usr/share/doc/lighttpd/traffic-shaping.txt
##
## Values are in kilobyte per second.
##
## Keep in mind that a limit below 32kB/s might actually limit the
## traffic to 32kB/s. This is caused by the size of the TCP send
## buffer.
##
## per server:
##
#server.kbytes-per-second = 128
##
## per connection:
##
#connection.kbytes-per-second = 32
##
#######################################################################
#######################################################################
##
## Filename/File handling
## ------------------------
##
## files to check for if .../ is requested
## index-file.names = ( "index.php", "index.rb", "index.html",
## "index.htm", "default.htm" )
##
index-file.names += (
"index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
##
## deny access the file-extensions
##
## ~ is for backupfiles from vi, emacs, joe, ...
## .inc is often used for code includes which should in general not be part
## of the document-root
url.access-deny = ( "~", ".inc" )
##
## disable range requests for pdf files
## workaround for a bug in the Acrobat Reader plugin.
##
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
##
## url handling modules (rewrite, redirect)
##
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.example.com/$1" )
##
## both rewrite/redirect support back reference to regex conditional using %n
##
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}
##
## which extensions should not be handle via static-file transfer
##
## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
##
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
##
## error-handler for status 404
##
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
##
#server.errorfile-prefix = "/srv/www/htdocs/errors/status-"
##
## mimetype mapping
##
include "conf.d/mime.conf"
##
## directory listing configuration
##
include "conf.d/dirlisting.conf"
##
## Should lighttpd follow symlinks?
##
server.follow-symlink = "enable"
##
## force all filenames to be lowercase?
##
#server.force-lowercase-filenames = "disable"
##
## defaults to /var/tmp as we assume it is a local harddisk
##
server.upload-dirs = ( "/var/tmp" )
##
#######################################################################
#######################################################################
##
## SSL Support
## -------------
##
## To enable SSL for the whole server you have to provide a valid
## certificate and have to enable the SSL engine.::
##
## ssl.engine = "enable"
## ssl.pemfile = "/path/to/server.pem"
##
## The HTTPS protocol does not allow you to use name-based virtual
## hosting with SSL. If you want to run multiple SSL servers with
## one lighttpd instance you must use IP-based virtual hosting: ::
##
## $SERVER["socket"] == "10.0.0.1:443" {
## ssl.engine = "enable"
## ssl.pemfile = "/etc/ssl/private/www.example.com.pem"
## server.name = "www.example.com"
##
## server.document-root = "/srv/www/vhosts/example.com/www/"
## }
##
## If you have a .crt and a .key file, cat them together into a
## single PEM file:
## $ cat /etc/ssl/private/lighttpd.key /etc/ssl/certs/lighttpd.crt \
## > /etc/ssl/private/lighttpd.pem
##
#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
##
## optionally pass the CA certificate here.
##
##
#ssl.ca-file = ""
##
#######################################################################
#######################################################################
##
## custom includes like vhosts.
##
#include "conf.d/config.conf"
#include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
##
#######################################################################
/etc/lighttpd/modules.conf 内容
#######################################################################
##
## Modules to load
## -----------------
##
## at least mod_access and mod_accesslog should be loaded
## all other module should only be loaded if really neccesary
##
## - saves some time
## - saves memory
##
## the default module set contains:
##
## "mod_indexfile", "mod_dirlisting", "mod_staticfile"
##
## you dont have to include those modules in your list
##
## Modules, which are pulled in via conf.d/*.conf
##
## NOTE: the order of modules is important.
##
## - mod_accesslog -> conf.d/access_log.conf
## - mod_compress -> conf.d/compress.conf
## - mod_status -> conf.d/status.conf
## - mod_webdav -> conf.d/webdav.conf
## - mod_cml -> conf.d/cml.conf
## - mod_evhost -> conf.d/evhost.conf
## - mod_simple_vhost -> conf.d/simple_vhost.conf
## - mod_mysql_vhost -> conf.d/mysql_vhost.conf
## - mod_trigger_b4_dl -> conf.d/trigger_b4_dl.conf
## - mod_userdir -> conf.d/userdir.conf
## - mod_rrdtool -> conf.d/rrdtool.conf
## - mod_ssi -> conf.d/ssi.conf
## - mod_cgi -> conf.d/cgi.conf
## - mod_scgi -> conf.d/scgi.conf
## - mod_fastcgi -> conf.d/fastcgi.conf
## - mod_proxy -> conf.d/proxy.conf
## - mod_secdownload -> conf.d/secdownload.conf
## - mod_expire -> conf.d/expire.conf
##
server.modules = (
"mod_access",
# "mod_alias",
# "mod_auth",
# "mod_authn_file",
# "mod_evasive",
"mod_redirect",
# "mod_rewrite",
# "mod_setenv",
# "mod_usertrack",
)
##
#######################################################################
#######################################################################
##
## Config for various Modules
##
##
## mod_geoip
##
#include "conf.d/geoip.conf"
##
## mod_ssi
##
#include "conf.d/ssi.conf"
##
## mod_status
##
#include "conf.d/status.conf"
##
## mod_webdav
##
#include "conf.d/webdav.conf"
##
## mod_compress
##
#include "conf.d/compress.conf"
##
## mod_userdir
##
#include "conf.d/userdir.conf"
##
## mod_magnet
##
#include "conf.d/magnet.conf"
##
## mod_cml
##
#include "conf.d/cml.conf"
##
## mod_rrdtool
##
#include "conf.d/rrdtool.conf"
##
## mod_proxy
##
include "conf.d/proxy.conf"
##
## mod_expire
##
#include "conf.d/expire.conf"
##
## mod_secdownload
##
#include "conf.d/secdownload.conf"
##
#######################################################################
#######################################################################
##
## CGI modules
##
##
## SCGI (mod_scgi)
##
#include "conf.d/scgi.conf"
##
## FastCGI (mod_fastcgi)
##
#include "conf.d/fastcgi.conf"
##
## plain old CGI (mod_cgi)
##
#include "conf.d/cgi.conf"
##
#######################################################################
#######################################################################
##
## VHost Modules
##
## Only load ONE of them!
## ========================
##
##
## You can use conditionals for vhosts aswell.
##
## see http://www.lighttpd.net/documentation/configuration.html
##
##
## mod_evhost
##
#include "conf.d/evhost.conf"
##
## mod_simple_vhost
##
#include "conf.d/simple_vhost.conf"
##
## mod_mysql_vhost
##
#include "conf.d/mysql_vhost.conf"
##
#######################################################################
查看信息
2) 执行cat /etc/issue,例如如下:
[root@localhost ~]# cat /etc/issue
CentOS release 5.5 (Final)
Kernel r on an m
3) 执行cat /etc/redhat-release ,例如如下:
[root@localhost ~]# cat /etc/redhat-release
CentOS release 5.5 (Final)
查看系统是64位还是32位:
1、getconf LONG_BIT or getconf WORD_BIT
[root@localhost ~]# getconf LONG_BIT
64
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1、看mysql服务是否在运行:
由于“socket”文件是由mysql服务运行时创建的,如果提示“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '***' (2)”,找不到“socket”文件,我们首先要确认的是mysql服务是否正在运行。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# 1、 端口是否打开 [root@aiezu.com ~]# lsof -i:3306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 12207 mysql 14u IPv4 52350 0t0 TCP *:mysql (LISTEN) # 2、mysqld服务是否正在运行 [root@aiezu.com ~]# service mysqld status mysqld (pid 4717) is running... # 3、如果mariadb,同样方法查服务是否正在运行: [root@aiezu.com ~]# service mariadb status Redirecting to /bin/systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: active (running) since 四 2016-11-03 13:47:37 CST; 23min ago |
四、故障解决方法:
解决方案一:
修改“/etc/my.cnf”配置文件,在配置文件中添加“[client]”选项和“[mysql]”选项,并使用这两个选项下的“socket”参数值,与“[mysqld]”选项下的“socket”参数值,指向的socket文件路径完全一致。如下:
1 2 3 4 5 6 7 8 9 10 11 12 |
[mysqld] datadir=/storage/db/mysql socket=/storage/db/mysql/mysql.sock ...省略n行(爱E族)... [client] default-character-set=utf8 socket=/storage/db/mysql/mysql.sock [mysql] default-character-set=utf8 socket=/storage/db/mysql/mysql.sock |
修改完后,重启mysqld服务,即可解决此问题。
2、确定“socket”文件正确位置:
确定mysql服务正常运行后,产生此错误的原因只剩下“socket”文件路径不正确了,我们可以使用“find”命令或者“lsof”命令来确定socket文件的正确路径:
1 2 3 4 5 |
[root@aiezu.com ~]# lsof -c mysqld|grep sock$ mysqld 4717 mysql 12u unix 0xffff88010a655b80 0t0 77474827 /storage/db/mysql/mysql.sock [root@aiezu.com ~]# find / -name '*.sock' /storage/db/mysql/mysql.sock |
解决方案二:
使用“ln -s /storage/db/mysql/mysql.sock /var/lib/mysql/mysql.sock”命令,将正确的socket文件位置,软链接到提示错误的socket文件路径位置,即可解决此问题:
1 2 3 4 5 |
[root@aiezu.com ~]# ls /var/lib/mysql/mysql.sock ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory [root@aiezu.com ~]# ln -s /storage/db/mysql/mysql.sock /var/lib/mysql/mysql.sock [root@aiezu.com ~]# ls /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock |
JDK1.8link:链接: 链接: https://pan.baidu.com/s/1miQLKe8
Linux(centos 7)配置tomcat8、JDK1.8、lighttpd、ngnix、mysql的更多相关文章
- 阿里云服务器Linux CentOS安装配置(三)yum安装mysql
阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...
- 阿里云服务器Linux CentOS安装配置(零)目录
阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...
- 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat
阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat 执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...
- Linux CentOS 6.6安装JDK1.7
Linux CentOS 6.6安装JDK1.7 目录 1.下载JDK 2.卸载JDK 3.安装JDK 3.1..rpm后缀格式JDK安装方式 3.2..tar.gz后缀格式JDK安装方式 4.验证安 ...
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
- 阿里云服务器Linux CentOS安装配置(七)域名解析
阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...
- 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...
- 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署
阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...
- 阿里云服务器Linux CentOS安装配置(二)yum安装svn
阿里云服务器Linux CentOS安装配置(二)yum安装svn 1.secureCRT连接服务器 2.先创建一个文件夹,用来按自己的习惯来,用来存放数据 mkdir /data 3.yum安装sv ...
随机推荐
- HTML中引用外部JS文件失效原因
今天在练习中碰到“引用外部的一个js文件但是却失效”的情况,实在不懂,百度后才知是引用的位置不对,错误的代码如下: <head> <meta charset="UTF-8& ...
- linux软件管理 RPM命令
RPM命名规则 httpd -2.2.15-15.el6.centos.1.i686.rpm (包全名) httpd 软件包名 (包名) 2.2.15 软件版本 15 软件发布的次数 el6.cent ...
- ACM-ICPC 2018 南京赛区网络预赛B
题目链接:https://nanti.jisuanke.com/t/30991 Feeling hungry, a cute hamster decides to order some take-aw ...
- python基础09_字符串格式化
首先,使用%s 的方法. #!/usr/bin/env python # coding:utf-8 # 不用format方法,使用%s 和%d name = 'Tom' age = 100 msg = ...
- HTML5:表格相关标记及其属性
表格相关标记及其属性 <table>:表格,包括以下属性 属性 说明 width 宽度(有像素和百分比两种表示方法) height 高度(有像素和百分比两种表示方法) border 边框粗 ...
- vs2015和Oracle在一起时的Shit问题
VS2015在连接Oracle时,必须要安装到一个不含有空格的目录中去,否则连接不上Oracle,至于为什么,不知道,鬼知道,日的. 如果你不幸以前安装过VS2015,安装到它的默认的什么“progr ...
- echarts双y轴折线图柱状图混合实时更新图
先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...
- ArcGIS 按多边形区域统计栅格影像的一些信息
在使用ArcGIS对栅格影像进行分析时,难免要进行一些统计类的分析.如统计框选区域的像素的个数,面积.均值等内容. 下面给出使用“Spatial Analyst Tools -- > Zonal ...
- 100道Java基础面试题收集整理(附答案)
不积跬步无以至千里,这里会不断收集和更新Java基础相关的面试题,目前已收集100题. 1.什么是B/S架构?什么是C/S架构 B/S(Browser/Server),浏览器/服务器程序 C/S(Cl ...
- 关于surface gradient
[转载请注明出处]http://www.cnblogs.com/mashiqi 2017/06/16 函数定义及前后文详见<Inverse Acoustic and Electromagneti ...