1.安装NGINX服务
tianyangtax@iZ25tc8mln7Z:~$ sudo apt-get update tianyangtax@iZ25tc8mln7Z:~$ sudo apt-get upgrade tianyangtax@iZ25tc8mln7Z:~$ sudo apt-get install nginx
2.配置NGINX基础设置
tianyangtax@iZ25tc8mln7Z:~$ sudo vim /etc/nginx/nginx.conf
tianyangtax@iZ25tc8mln7Z:~$ sudo cat /etc/nginx/nginx.conf
user www-data;
worker_processes 4; ## 根据CPU核心数目设置
pid /run/nginx.pid;
worker_rlimit_nofile 65535; ## 根据 rlimit -n 数目设置
events {
use epoll;
worker_connections 2048;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 1024M;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
##
# Fastcgi Settings
##
fastcgi_connect_timeout 1800;
fastcgi_send_timeout 1800;
fastcgi_read_timeout 1800;
fastcgi_buffer_size 1024k;
fastcgi_buffers 32 1024k;
fastcgi_busy_buffers_size 2048k;
fastcgi_temp_file_write_size 2048k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
3.配置防火墙,打开WEB端口
tianyangtax@iZ25tc8mln7Z:~$ sudo ufw allow 80 Rule added Rule added (v6) tianyangtax@iZ25tc8mln7Z:~$ sudo ufw status Status: active To Action From -- ------ ---- 2002 ALLOW Anywhere 21 ALLOW Anywhere 80 ALLOW Anywhere 2002 (v6) ALLOW Anywhere (v6) 21 (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6)
Categories: ubuntu
