首页 > 其他 > 详细

ngnix随笔二

时间:2020-04-18 19:50:07      阅读:62      评论:0      收藏:0      [点我收藏+]

ngnix配置文件

1.rpm -ql nginx

/etc/logrotate.d/nginx
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/modules
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/usr/lib64/nginx
/usr/lib64/nginx/modules
/usr/libexec/initscripts/legacy-actions/nginx
/usr/libexec/initscripts/legacy-actions/nginx/check-reload
/usr/libexec/initscripts/legacy-actions/nginx/upgrade
/usr/sbin/nginx
/usr/sbin/nginx-debug
/usr/share/doc/nginx-1.16.1
/usr/share/doc/nginx-1.16.1/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/var/cache/nginx
/var/log/nginx

2. 配置文件

  vim  /etc/nginx/nginx.conf

#启动nginx的用户
user  nginx;
#worker的数量,一般与CPU数量一致 worker  number| auto;
worker_processes 2;
#绑定worker与cpu的cpu号  00000001:0号cpu   00000010:2号cpu  00000100:3号cpu...10000000:8号cpu
worker_cpu_affinity 0001 0001;
#worker进程的优先级  [-20,20]
worker_priority 10;
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;
    #自定义的虚拟主机配置文件,耦合性低方便维护
    include /etc/nginx/conf.d/vhosts/*.conf;
}
[root@192 ~]# vim /etc/nginx/conf.d/vhosts/
a.com.conf  b.com.conf  
一下以a为例:
#vim /etc/nginx/conf.d/vhosts/a.com.conf    
server {
     #监听的端口 listen
80;
     #服务器名称 server_name www.a.com;
     #主页目录 root /data/vhosts/www.a.com; }

创建主页目录  

  #mkdir /data/vhosts/www.a.com/ -p
  #mkdir /data/vhosts/www.b.com/ -p

创建主页

#echo www.a.com > /data/vhosts/www.a.com/index.html
#echo www.b.com > /data/vhosts/www.b.com/index.html

重启nginx即可

 

ngnix随笔二

原文:https://www.cnblogs.com/hekuangquanshuiweiteng/p/12726907.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!