linux下nginx配置host使用IP和端口访问

发布时间:2022-04-19浏览次数:0

支持注册ChatGPT Plus的OneKey虚拟卡
绑定Apple Pay、Google Pay、支付宝和微信支付进行日常消费

注册和了解更多 ->

silver

linux下nginx配置host使用IP和端口访问

server {
    listen       81;   #端口号
    server_name  47.110.242.239;  #主机名
    index  index.php index.html index.htm;
    root   /usr/local/nginx/html/qpl_system/;
    error_page  404              /404.html; # 错误页面
    location / {
        if (!-e $request_filename){
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }
     location ~ \.php($|/) {
      set $script     $uri;
        set $path_info  "";
        if ($uri ~ "^(.+?\.php)(/.+)$") {
            set $script     $1;
            set $path_info  $2;
        }
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME    $document_root$script;
        fastcgi_param  SCRIPT_NAME        $script;
        fastcgi_param  PATH_INFO          $path_info;  
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires      1d;
    }
    location ~ .*\.(js|css)?$ {
        expires      12h;
    }
    location  /ngx_status {
    stub_status on;
    access_log off;
    #allow 127.0.0.1;
    #deny all;
    }
    error_log   /usr/local/nginx/html/qpl_system/qpl_error.log;
    access_log  /usr/local/nginx/html/qpl_system/qpl_access.log;
}

字节笔记本扫描二维码查看更多内容