小编Ace*_*Ace的帖子

VSCode 导入“C”在模块上失败

请看下面的截图:

带有 golang 导入“C”错误的 vscode

它说:

无法导入 C(导入路径 C 没有包数据)

我附上了一个重现失败的示例项目,在这里:https : //github.com/microsoft/vscode/files/3783446/example-project.zip

我将 Go 1.13 与 Go 和 C/C++ 的每个扩展的最新版本一起使用。没有编译器错误,这似乎是一个“vscode 问题”。

有没有办法解决这个 vscode 问题?

c go cgo visual-studio-code

6
推荐指数
1
解决办法
5140
查看次数

NGINX具有反向代理的多个服务器块

我正在运行nginx + PHP + MySQL,以及windows上的tomcat + postresql(我知道它不是很好用的资源,我只需要它们用于某些项目).

我需要一点nginx配置的帮助.我最终计划在端口80上运行nginx,其中wiki.example.com和site.example.com是相同的IP.但我想将site.example.com的请求转发到localhost:8080的tomcat,并且nginx将为wiki.example.com提供服务.

我知道我的问题在于配置,只是因为我可以在控制台中看到错误; 即使它们位于不同的服务器块中,我也无法设置两个"位置/"设置.这是我的配置,有谁知道如何解决它?

http {
include       mime.types;
default_type  application/octet-stream;

server {
listen 8080 default_server;
server_name _;
server_name_in_redirect off;
root  www/html;
}

server {
    listen       wiki.example.com:8080;
    server_name  wiki.example.com;

    location / {
        #proxy_pass http://localhost:80/;
        #proxy_set_header  Host $http_host;
        root   www/wiki;
        index  index.html index.htm index.php;
    }

    location ~ .php$ {
        root           www/wiki;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
        index index.php;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    } …
Run Code Online (Sandbox Code Playgroud)

tomcat nginx

4
推荐指数
1
解决办法
9248
查看次数

HAProxy - 添加响应标头以指示所选的服务器

考虑以下HAProxy配置:

frontend front
        default_backend default

backend default
        balance roundrobin
        http-response set-header X-RGN us-east-1
        server app-1a app.us-east-1a.example.com:443 ssl verify none check
        server app-1c app.us-east-1c.example.com:443 ssl verify none check
        server app-1b app.us-east-1b.example.com:443 ssl verify none check
Run Code Online (Sandbox Code Playgroud)

我想返回一个响应头,表示所选的服务器.例如,如果前端收到请求,它将平衡roundrobin并将请求转发到后端服务器,当它响应时,我想在浏览器中看到使用了哪个服务器.

配置可能如下所示:

frontend front
        default_backend default

backend default
        balance roundrobin
        http-response set-header X-RGN us-east-1
        server app-1a app.us-east-1a.example.com:443 ssl verify none check
        server app-1c app.us-east-1c.example.com:443 ssl verify none check
        server app-1b app.us-east-1b.example.com:443 ssl verify none check
        http-response set-header X-Server app-1a if server -i app-1a
        http-response set-header X-Server …
Run Code Online (Sandbox Code Playgroud)

header haproxy http-headers

3
推荐指数
1
解决办法
4686
查看次数

NGINX 正则表达式位置 - 以 X 开头且不包含 Y

我有以下位置配置:

location ~ ^/(trucks|cars|planes|system|tools) {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/htauth_file;
        proxy_set_header Host "server.lan";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass  http://127.0.0.1:8080$request_uri;
}
Run Code Online (Sandbox Code Playgroud)

有人提出请求时

/卡车

或者

/汽车

等等,我希望它们通过基本身份验证进行身份验证。但当有人提出要求时

/卡车?id=123

或者

/汽车?id=124

那么我不需要身份验证,需要处理较低的位置块。

当 URI 中存在问号时,我基本上不希望位置匹配。

有没有办法修改我粘贴的配置,使其在 URI 中存在问号时不匹配?

regex configuration nginx

1
推荐指数
1
解决办法
8983
查看次数