zoukankan      html  css  js  c++  java
  • nginx*服务器域名解析配置实操

    1、进入nginx目录cd conf:创建文件夹

    sudo mkdir vhost,cd vhost,sudo vim www.fanxing.store.conf,添加如下内容

    server {
    default_type 'text/html';
    charset utf-8;
    listen 80;
    autoindex on;
    server_name www.fanxing.store;
    access_log /usr/local/nginx/logs/access.log combined;
    index index.html index.htm index.jsp index.php;
    #error_page 404 /404.html;
    if ( $query_string ~* ".*[;'<>].*" ){
    return 404;
    }
    location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* {
    deny all;
    }
    location / {
    #root /product/ftpfile/learning/;

    proxy_pass http://127.0.0.1:8080; //暂时跳到tomcat
    add_header Access-Control-Allow-Origin *;
    }
    }

    保存

    2.重启nginx:sudo ../../sbin/nginx -s rload

    3.配置文件服务器

    server {
    listen 80;
    autoindex off;
    server_name image.fanxing.store;
    access_log /usr/local/nginx/logs/access.log combined;
    index index.html index.htm index.jsp index.php;
    #error_page 404 /404.html;
    if ( $query_string ~* ".*[;'<>].*" ){
    return 404;
    }
    location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* {
    deny all;
    }
    location / {
    root /ftpfile/;
    add_header Access-Control-Allow-Origin *;
    }
    }

    *****出现404Not Found:image.fanxing.store末尾未加.conf,如果未配置,默认加载nginx/下的nginx.conf

    (nginx: [warn] conflicting server name "image.fanxing.store" on 0.0.0.0:80, ignored,)

    nginx -s reload

    重启nginx报错。

    [warn]: conflicting server name “domain.com” on 0.0.0.0:80, ignored

    检查:server/nginx-1.4.7/conf/vhosts 下的配置文件,应该有重复绑定域名的,找到,修改或删除即可。

    如果image.fanxing.store.conf:autoindex off;就无法访问目录结构,出现403forbidden错误,不可访问;

    *******

  • 相关阅读:
    jquerymobile 的特有 事件 和 方法 (转)
    JQueryMobile开发必须的知道的知识(转)
    Google地图之OverlayView使用(自定义叠加层)
    [TPYBoard
    [TPYBoard
    [TPYBoard
    【micropython】用python来进行BadUSB的USB-HID测试(含无线控制)
    利用51单片机制作廉价盒仔机器人
    linux 的内核的作用和功能
    计算机操作系统中的硬件资源和软件资源都包括哪些
  • 原文地址:https://www.cnblogs.com/coolcold/p/8335632.html
Copyright © 2011-2022 走看看