zoukankan      html  css  js  c++  java
  • 把域名绑定到某个项目,以nginx服务器为例

    一:登陆域名服务器平台,把域名解析到项目对应的IP上面。

    二:配置nginx服务器

      1./etc/nginx/conf.d/ 在服务器该目录下,添加.conf文件,如命名为:www.demo.com.conf

    server {
        listen       80;
        server_name  www.demo.com;
    
        location / {
            root   /data/www/demo;
            index  index.html index.htm index.php;
    
            if (!-e $request_filename) {
               #rewrite ^(.*)$ /index.php?s=$1 last;
               rewrite ^/(.*)$ /index.php/$1 last;
               break;
            }
        }
    
        error_page  404              /404.html;
        location = /404.html {
            root   /data/www/demo;
        }
    
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /data/www/demo;
        }
    
        location ~ .php {
        root           /data/www/demo;
    
        fastcgi_pass 127.0.0.1:9000;
    
        fastcgi_index index.php;
    
        include fastcgi.conf;
    
        set $real_script_name $fastcgi_script_name;
    
        if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
    
            set $real_script_name $1;
    
            set $path_info $2;
    
        }
    
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    
        fastcgi_param SCRIPT_NAME $real_script_name;
    
        fastcgi_param PATH_INFO $path_info;
    
        }
    
    }

    2: 重启nginx服务器

      使用Xshell等远程登陆工具,执行:nginx -s reload(修改配置后重新加载生效

  • 相关阅读:
    python学习
    androidandroid中的通过网页链接打开本地app
    Android自定义View之绘制虚线
    Backbone学习记录(3)
    Backbone学习记录(2)
    Backbone学习记录(1)
    网络时间轴中竖线的含义
    控制台笔记
    css hack 笔记
    Fiddler学习笔记
  • 原文地址:https://www.cnblogs.com/wangyuman26/p/6225823.html
Copyright © 2011-2022 走看看