zoukankan      html  css  js  c++  java
  • nginx.conf配置文件的简单说明

    #nginx 监听原理 先监听端口 --> 再配置域名 -->匹配到就访问local  否则  没有匹配到域名就默认访问第一个监听端口的local地址

    # vi nginx.conf user nobody nobody; # 运 nginx的所属组和所有者 worker_processes 2; # 开启两个 nginx工作进程,一般几个 CPU核心就写几 error_log logs/error.log notice; # 错误日志路径 pid logs/nginx.pid; # pid 路径 events { worker_connections 1024; # 一个进程能同时处理1024个请求 } http {   include 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 logs/access.log main; # 默认访问日志路径   sendfile on;   keepalive_timeout 65; # keepalive超市时间   # 开始配置一个域名,一个server配置段一般对应一个域名   server {     listen 80; # 监听端口()     # 在本机所有ip上监听80,也可以写为192.168.1.202:80,这样的话,就只监听192.168.1.202 上的80口     server_name www.heytool.com; # 域名     root /www/html/www.heytool.com; # 站点根目录(程序目录)     index index.html index.htm; # 索引文件
        #  可以有多个 location 
        location / { 
          #proxy_pass www.baidu.com # 跳到 百度页面 (网址)       root
    /www/html/www.heytool.com; # 站点根目录(程序目录) (本地的路径)     }
        error_page
    500 502 503 504 /50x.html;     # 定义错误页面,如果是500错误,则把站点根目录下的50x.html返回给用户     location = /50x.html {     root /www/html/www.heytool.com;   } }
    #nginx 监听原理 先监听端口 --> 再配置域名 -->匹配到就访问local  否则  没有匹配到域名就默认访问第一个监听端口的local地址

    //看到ok和successful,说明配置文件没问题 

    # /usr/local/nginx-1.0.6/sbin/nginx –t 
    nginx: the configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf test is successful

    #启动 nginx
    # /usr/local/nginx-1.0.6/sbin/nginx


    #重启 nginx
    # /usr/local/nginx-1.0.6/sbin/nginx  -s reload

  • 相关阅读:
    jumpserver安装教程
    正则表达式基础->
    Awk基础
    shell脚本练习题->1
    idea开发工具下载安装教程
    shell 数组基础->
    动荡的国庆前后
    Linux命令之查找
    2013年9月游戏测试总结-文档习惯
    将C#程序做成服务后服务自动停止的问题
  • 原文地址:https://www.cnblogs.com/lemon-flm/p/7102766.html
Copyright © 2011-2022 走看看