Linux(centos 7)配置tomcat8、JDK1.8、lighttpd、ngnix、mysql

来源:http://www.cnblogs.com/dingjiuping/archive/2017/09/01/7463555.html
-Advertisement-
Play Games

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 ...


                                                  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

  1. ${JAVA_HOME}/jre/lib/security/java.security  

 

2,vi 打開後找到

[html] view plain copy

  1. securerandom.source=file:/dev/urandom  

 

修改

[html] view plain copy

  1. 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-servermysql-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 <[email protected]>"
 指紋       : 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用戶登錄mysqlmysql -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 con

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • Oracle: --concat(str1,str2)字元串拼接函數 select concat(t.uuid,t.name) from group t; select t.uuid || t.name from group t;--initcap(str)將每個單詞首字母大寫,其他字母小寫sele ...
  • 因為這兩天業務需求不是很多,昨天抽空研究了下MySQL的主從同步。 期間也遇到了許多問題,怕之後會忘記,也順便記錄下自己的成長經歷。所以寫這篇博文。 因為我是在VM虛擬機上進行的測試。 所以首先要把虛擬機的鏈接模式改為橋接模式。 在設置->硬體->網路適配器->網路連接里更改為橋接模式。 如果不是使 ...
  • 一、表與庫的概念 資料庫管理數據,它是以什麼樣的形式組成的? 生活中的表 >表 table多行多列,傳統的資料庫都是這樣的;聲明瞭表頭,一個表創建好了,剩下的就是往表中添加數據 多張表放在檔案中 >庫 database學生信息表,成績表,記過表 -> 都是這個班級的信息,將這幾張表放在一個文件夾中 ...
  • 書內容的思維導圖與讀後感 圖片顯示的大小有限制,可以右擊 在新標簽頁中打開圖片,或者, "點擊下載源文檔" : 思維 : 從《浪潮之巔》里描述的企業變遷,感受思維可以決定一個企業的方向,如果方向與新時代不符,很難改變走向頹廢或消失的結果,因為企業的基因問題,就是思維難以改變; 再到《智能時代》從第一 ...
  • 本文主要講述了PG的幾個主要進程,以及PG的核心架構。進程和體繫結構詳見下圖: 從上面的體繫結構圖可以看出來,PG使用經典的C/S架構,進程架構。在伺服器端有主進程、服務進程、子進程、共用記憶體以及文件存儲幾大部分,下麵著重講述伺服器端的進程部分: 1. Postmaster主進程和服務進程 當PG數 ...
  • 目前統計異常:ORA-00000、ORA-00001、ORA-00017、ORA-00018、ORA-00019、ORA-00020、ORA-01722、ORA-01747 文檔通過翻譯文檔、搜索資料及測試實踐對Oralce的異常做彙總、分析導致異常的各類原因及對應的解決方法,並備註一些知識點以助學... ...
  • 1. 原來的yum源做備份 2. 下載新的yum源 我用的vagrant centos 6.5 的box,預設沒有裝wget命令,yum源里也沒有wget包,下載下來替換 "阿裡yum源" "網易yum源" tips : 具體的linux版本及系統版本請自行選擇,當然,還有其他的源,選擇你自己喜歡的 ...
  • Linux PC應用程式gdb調試: 1、查看core文件參數 yinkui@yinkui-desktop:~/File_unzip/cp_module$ ulimit -a core file size (blocks, -c) 0 //產生core文件數目,不會產生core文件 data seg ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...