首页 > 系统相关 >nginx 默认配置文件

nginx 默认配置文件

时间:2023-05-20 09:03:59浏览次数:39  
标签:index log 配置文件 默认 server nginx html location error

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  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;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.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;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

  

标签:index,log,配置文件,默认,server,nginx,html,location,error
From: https://www.cnblogs.com/wanglichaoya/p/17416715.html

相关文章

  • 前端如何将项目部署到服务器(Nginx)
    一、准备环境1、服务器或者虚拟机(后端已经搭建好的,这里就不讲述如何搭建服务器了)2、Xshell和Xftp-->存放静态文件和操作服务器3、Windows系统Xshell:是一个强大的安全终端模拟软件,可以在Windows界面下用来访问远端不同系统下的服务器。(作用就是用来连接远程服务器的)Xftp:是一......
  • JavaScript全解析——ES6函数中参数的默认值和解构赋值
    本文为千锋资深前端教学老师带来的【JavaScript全解析】系列,文章内含丰富的代码案例及配图,从0到1讲解JavaScript相关知识点,致力于教会每一个人学会JS!文末有本文重点总结,可以收藏慢慢看~更多技术类内容,主页关注一波!ES6函数中参数的默认值给函数的形参设置一个默认值,当你没有......
  • Docker容器安装示例(nginx、redis、nacos、oracle)
    1.nginx示例1.创建容器1.查看是否有nginx镜像dockerimages2.如果没有镜像,可以搜索镜像dockersearchnginx3.指定版本拉取nginxdockerpullnginx:1.20.04.查看镜像dockerimages5.创建容器(-d后台运行,-p容器80端口映射到宿主机8080端口,指定名称nginx-test,指定镜像ID:......
  • nginx proxy_set部分常见配置
    目录nginxproxy_set部分常见配置nginxproxy_set部分常见配置proxy_set_headerHost$host;#用途:设置要发送到代理服务器的HTTP请求头的Host字段。$host变量将被替换为客户端请求中的实际主机名。proxy_set_headerConnection"";#用途:清空要发送到代理服务器的HTTP请求头......
  • 记一次前后端项目Nginx代理出现的“405”问题
    事情的起因是这样的:因为好久没有写前端代码了对前端打包部署这块有点抵触公司的有个小项目是前端vue+后端springboot实现的在部署的时候通过nginx反向代理去实现跨域(这块nginx一直都是简单的使用也没有过深的了解包括之前也用过nginx+memache实现的灰度部署的方案)总感觉很......
  • 从零玩转Nginx
    01【熟悉】实际开发中的问题?现在我们一个项目跑在一个tomcat里面当一个tomcat无法支持高的并发量时。可以使用多个tomcat那么这多个tomcat如何云分配请求|-nginx02【熟悉】服务器概述1,目前常见的web服务器1,Apache(http://httpd.apache.org)它是世界上用的最多的web服务器,......
  • 转载【环境搭建】docker+nginx部署PHP
      目的使用docker容器完成nginx的安装以及部署PHP网页步骤一、安装nginx1.拉取Nginx镜像dockerpullnginx//拉取镜像dockerimages//查看本地镜像这里注意需要记一下nginx的IMAGEID,我这里的ID是605c2.创建Nginx容器dockerrun--nam......
  • docker安装nginx
    dockerpullregistry.cn-hangzhou.aliyuncs.com/ns-w/wh-w:nginx-1.22.0创建挂载目录mkdir-p/opt/resource/nginx/confmkdir-p/opt/resource/nginx/logmkdir-p/opt/resource/nginx/html生成容器dockerrun--namenginx-1.22.0-p80:80-dregistry.cn-hangzhou.aliy......
  • 2、TOMCAT实现在一个服务器上搭建多个网站、8080改80端口、TOMCAT默认页面三个选项
    在一个服务器上搭建多个网站如何实现三种方案:IP来区分、端口号来区分、host来区分如nginx中IP来区分:server{listen1.1.1.1:80;}server{listen2.2.2.2:80;}端口号来区分:server{listen1.1.1.1:80;}server{listen1.1.1.1:81;}host(主机头)来区分:ser......
  • nginx出现: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误
     问题情况登陆服务器之后进到nginx使用./nginx-sreload重新读取配置文件,发现报==nginx:[error]open()“/usr/local/nginx/logs/nginx.pid”failed(2:Nosuchfileordirectory)==错误,进到logs文件发现的确没有nginx.pid文件如下图解决方法执行下列命令/usr......