服務端環境準備流程
阿新 • • 發佈:2018-11-13
nginx
- 安裝
- yum install nginx
- 配置
- /etc/nginx/nginx.conf
- 建立 /etc/nginx/include/arcus.taou.com 目錄
- 建立 env.conf 檔案
- 建立 vhost.conf 檔案
- 管理
- 啟動
- /usr/sbin/nginx -c /etc/nginx/nginx.conf
- 退出
- /usr/sbin/nginx -s quit
- /usr/sbin/nginx -s quit
- 重啟
- /usr/sbin/nginx -s reopen
- 重新載入配置
- /usr/sbin/nginx -s reload
- 啟動
tomcat
- 安裝
- tar -zxvf apache-tomcat-8.5.32.tar.gz -C /usr/local/
- 安裝 tomcat-native
- yum install apr-devel apr apr-util
- tar -zxvf tomcat-native.tar.gz
-
cd
/usr/local/tomcat/bin/tomcat-native-1
.2.17-src
/native
.
/configure
make
&&
make
install
- 配置
- bin/catalina.sh
- conf/server.xml
- 管理
- 啟動
- /usr/local/tomcat/bin/startup.sh
- 停止
- /usr/local/tomcat/bin/shutdown.sh
- 啟動
php-fpm
- 安裝
-
tar -zxvf php-7.0.30.tar.gz
.
/configure
--prefix=
/usr/local/php
--with-curl --with-freetype-
dir
--with-gd --with-gettext --with-iconv-
dir
--with-kerberos --with-libdir=lib64 --with-libxml-
dir
--with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-
dir
--with-jpeg-
dir
--with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --
enable
-fpm --
enable
-bcmath --
enable
-libxml --
enable
-inline-optimization --
enable
-gd-native-ttf --
enable
-mbregex --
enable
-mbstring --
enable
-opcache --
enable
-pcntl --
enable
-shmop --
enable
-soap --
enable
-sockets --
enable
-sysvsem --
enable
-sysvshm --
enable
-xml --
enable
-zip --
enable
-exif
-
- 配置
- etc/php-fpm.conf
- lib/php.ini
- 管理
- 啟動
- service php-fpm start
- 停止
- service php-fpm stop
- 啟動
- 修改系統開啟檔案數
-
/etc/security/limits.conf
* soft nofile 204800
* hard nofile 204800
* soft nproc 204800
* hard nproc 204800
-
-
- 立即生效</p>
- ulimit -n 204800
- 立即生效</p>
- 目錄許可權管理
-
lychee
cd
/home/q/php/php_upload
chown
-R nobody:nobody lychee/
-
php_upload
cd
/home/q/php/php_upload
chown
-R nobody:nobody logs/
chown
-R nobody:nobody server/
chown
-R nobody:nobody upload/
- 軟連線
-
aapt
tar
-xjf
env
/apktool-install-linux-r05-ibot
.
tar
.bz2
ln
-s
/root/tools/apk_env_dir/apktool-install-linux-r05-ibot/aapt
/bin/aapt
-
-
-
- yum安裝
- yum install unzip
- lycheeupload
- 安裝
將程式安裝到 /home/q/python/lycheeupload 目錄中 - 測試
python /home/q/python/lycheeupload/lycheeupload.py -p -v -f /root/test/pic/big.png -q 99 [email protected]:/home/q/php/php_upload/lychee/
- 安裝
- yum安裝
activemq
- 部署伺服器:10.9.11.206
- 部署位置:/usr/local/activemq
- 管理
- 啟動
- /usr/local/activemq/bin/activemq start
- 停止
- /usr/local/activemq/bin/activemq stop
- 啟動
- 賬號配置:/usr/local/activemq/conf/jetty-realm.properties
tcp核心引數
vim
/etc/sysctl
.conf
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
儲存後執行如下命令使其立即生效:
/sbin/sysctl
-p
|
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log
/data/nginx/logs/error
.log;
pid
/run/nginx
.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include
/usr/share/nginx/modules/
*.conf;
events {
use epoll;
worker_connections 10240;
}
http {
log_format full
'$remote_addr $request_length $body_bytes_sent $request_time[s] - - [$time_local] '
'"$request" $status $http_referer "-" "$http_user_agent" $server_name $server_addr '
'$http_x_forwarded_for $http_x_real_ip'
;
access_log
/data/nginx/logs/allweb
.log full;
sendfile on;
gzip
on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
client_body_timeout 10;
client_header_timeout 10;
types_hash_max_size 2048;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
output_buffers 1 32k;
client_max_body_size 1g;
client_body_buffer_size 256k;
include
/etc/nginx/mime
.types;
default_type application
/octet-stream
;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include
/etc/nginx/conf
.d/*.conf;
server {
listen 8001 default_server;
listen [::]:8001 default_server;
server_name localhost;
root
/usr/share/nginx/html
;
# Load configuration files for the default server block.
include
/etc/nginx/default
.d/*.conf;
location / {
}
error_page 404
/404
.html;
location =
/40x
.html {
}
error_page 500 502 503 504
/50x
.html;
location =
/50x
.html {
}
}
include include/*
/vhost
.conf;
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
|
fastcgi_param DOCUMENT_DIR
/home/q/system/arcus
.taou.com/;
fastcgi_param ENV_FILE
/home/q/system/arcus
.taou.com
/ENV
;
fastcgi_param WEB_LOG_DIR
/data/nginx/logs/arcus
.taou.com
/web/
;
fastcgi_param APP_LOG_DIR
/data/nginx/logs/arcus
.taou.com
/app/
;
fastcgi_param ACCESS_LOG_FILE
/data/nginx/logs/arcus
.taou.com
/web/arcus
.taou.com-access.log;
fastcgi_param ERROR_LOG_FILE
/data/nginx/logs/arcus
.taou.com
/web/arcus
.taou.com-error.log;
fastcgi_param DATA_DIR
/data/nginx/data/arcus
.taou.com/;
fastcgi_param CACHE_DIR
/data/nginx/cache/arcus
.taou.com/;
fastcgi_param UPLOAD_DIR
/data/nginx/upload/arcus
.taou.com/;
fastcgi_param CLIENT_BODY_TEMP_DIR
/data/nginx/client_body_temp/
;
fastcgi_param PROXY_TEMP_DIR
/data/nginx/proxy_temp/
;
fastcgi_param FASTCGI_TEMP_DIR
/data/nginx/fastcgi_temp/
;
fastcgi_param SCGI_TEMP_DIR
/data/nginx/scgi_temp/
;
fastcgi_param UWSGI_TEMP_DIR
/data/nginx/uwsgi_temp/
;
|
gzip_static on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text
/plain
text
/css
application
/json
application
/x-javascript
text
/xml
application
/xml
application
/xml
+rss text
/javascript
;
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 80 default;
root
/home/q/system/arcus/
;
access_log
/data/nginx/logs/arcus
.taou.com
/web/arcus
.taou.com-access.log;
error_log
/data/nginx/logs/arcus
.taou.com
/web/arcus
.taou.com-error.log;
client_body_temp_path
/data/nginx/client_body_temp/
1 2;
proxy_temp_path
/data/nginx/proxy_temp/
1 2;
fastcgi_temp_path
/data/nginx/fastcgi_temp/
1 2;
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_connect_timeout 75s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
fastcgi_connect_timeout 300;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
location
/lychee
{
alias
/home/q/php/php_upload/lychee
;
index index.htm index.html index.php;
autoindex on;
}
location / {
alias
/home/q/system/arcus
.taou.com
/front/
;
}
location
/cache
{
alias
/home/q/system/arcus
.taou.com
/cache
;
}
location
/arcus
{
proxy_pass http:
//backend
;
proxy_set_header x-forwarded-
for
$remote_addr;
proxy_http_version 1.1;
proxy_set_header Connection
""
;
}
location
/admin
{
proxy_pass http:
//backend
;
proxy_set_header x-forwarded-
for
$remote_addr;
proxy_http_version 1.1;
proxy_set_header Connection
""
;
}
location
/apk/
{
alias
/home/q/apk/nginx/
;
}
location ~* \.php$ {
include fastcgi.conf;
include include
/arcus
.taou.com
/env
.conf;
root
/home/q/php/php_upload/
;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
location
/start/
{
proxy_pass http:
//backend/arcus/start/
;
proxy_set_header x-forwarded-
for
$remote_addr;
proxy_http_version 1.1;
proxy_set_header Connection
""
;
}
}
|