centeros上 nginx配置。安装
centerOS安装nginx ,简单配置多个端口服务;
1.wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm下载对应当前系统版本的nginx包(package)
2.rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm建立nginx的yum仓库
3.yum install nginx 下载并安装nginx
配置代码:
user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
    sendfile        on;
    #tcp_nopush     on;
keepalive_timeout 65;
#gzip on;
# include /etc/nginx/conf.d/*.conf;
server {
listen       9999;
server_name  localhost1;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root   /etc/nginx/test;
index  1.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html;
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
}
server {
listen       4399;
server_name  localhost2;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root   /etc/nginx/test;
index  flyerGame.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
}
}
 
                    
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号