阿里云ecs主机nginx配置文件位于:
/alidata/server/nginx/conf/nginx.conf
阿里云 主机nginx
//设置用户与组
user www www;
//启动子进行数,可以通过ps aux| grep nginx 查看
worker_processes 1;
//错误日志文件,日志级别
error_log /alidata/log/nginx/error.log crit;
//进程号保存文件
pid /alidata/server/nginx/logs/nginx.pid;
Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
//每个进程可以处理的连接数,受系统文件限制
worker_connections 65535;
}
http {
include mime.types; 为文件类型定义文件
default_type application/octet-stream; 默认文件类型
#charset gb2312;
server_names_hash_bucket_size 128;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on; 是否开启压缩功能 一般默认开启
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
log_format '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
include/alidata/server/nginx/conf/vhosts/*.conf;
}
include/alidata/server/nginx/conf/vhosts/*.conf;
引入多站点的配置
多站点配置 后面只需进入 include/alidata/server/nginx/conf/vhosts目录下
cp default.conf.bak “你的站点域名”.conf
更改相应的目录和解析即可。
配置完成后需重启nginx服务:
重启服务器:/alidata/server/nginx/sbin/nginx -s reload