首页 > 系统相关 >nginx代理本地目录配置文件

nginx代理本地目录配置文件

时间:2023-02-27 17:22:13浏览次数:48  
标签: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;
        }
        
        location /  {
            alias D:/;#此处定义映射文件位置
            allow all;
            autoindex on;
        }
        # 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;
    #    }
    #}

}

以上替换nginx文件,并且保证操作电脑有D盘,如没有需修改对应location下得alias

标签:index,log,配置文件,server,nginx,html,location,本地,error
From: https://www.cnblogs.com/goPush/p/17160516.html

相关文章

  • vite 打包vue3项目 nginx配置访问 生成dist文件夹文件
    其中一个是,vite项目执行“vitebuild”并部署上线后,在浏览器中访问就会有以下关于路由的奇怪问题:我们用嵌套路由开发的页面生成的路径,个别菜单在初次加载、或者二......
  • 本地仓库推送到远程仓库
    1、创建远程仓库(这里用的是码云https://gitee.com)2、生成SSH公钥步骤ps:先使用cd~/.ssh查看是否生成过SSH公钥,如果看到NOsuchfileordirectory,代表没有生成公钥。......
  • 本地虚拟机centos7通过docker安装主从redis3.2
    1、下载redisdocker镜像dockerpullredis:3.22、在home下建立mydata目录在/home/mydata/redis下面建立两个目录conf与data3、docker运行主从dockerrun-p6379:6379--n......
  • 本地虚拟机centos7通过docker安装主从mysql5.7.21
    1、下载mysql镜像dockerpullmysql:5.7.212、在home下建立mydata目录在/home/mydata/mysql下面建立两个目录conf与data3、docker运行起来两个服务器的服务dockerrun-p3......
  • 本地虚拟机centos7空间扩展10G记录
    因为要安装oracle11g的docker版本,空间不够,所以增加10G空间进入linux系统df-h发现跟原来一样没有增加,需要进行操作按下面操作,主要是fdisk/dev/sda[root@localhost~]#fdis......
  • nginx反向代理WebSocket
    1.nginx反向代理websocket原理2.nginx配置文件详解2.1map值映射2.2upstream2.3location3.nginx反向代理协议升级======================================......
  • Nginx安装jdk
    系统环境为CentOS-7-x86_64。一、文件下载 二、安装2.1文件准备2.2解压准备好gz安装包后,直接解压即安装,这里演示安装到/usr/java目录下。  移动安装包到/us......
  • android开发 - 拍照和选择本地图片库
    1.首先在布局文件中定义两个按钮 2.开启摄像头或者选择本地库privatefinalintIMAGE_RESULT_CODE=1;//拍照意图回传值结果码</span>privatefinalintIMAGE_RESULT_OP......
  • Maven仓库------本地仓库、远程仓库
    一、本地仓库就是Maven在本地存储构件的地方。注:maven的本地仓库,在安装maven后并不会创建,它是在第一次执行maven命令的时候才被创建maven本地仓库的默认位置:无论是Windo......
  • docker for nginx run
    PSC:\Users\[user]>dockerpullnginx:latestlatest:Pullingfromlibrary/nginxbb263680fed1:Alreadyexistsa0bc35e70773:Pullcomplete077b9569ff86:Pullco......