我在NGinx下有一个webapp和另一个正面负载均衡器,如下所示(xxxx = IP地址):
客户端(aaaa) - > LB(bbbb) - > NGX(cccc) - > WEBAPP(dddd)
这是我的NGinx配置的片段:
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
real_ip_header X-Forwarded-For;
set_real_ip_from b.b.b.b;
real_ip_recursive on;
}
Run Code Online (Sandbox Code Playgroud)
X-Forwarded-For客户端IP X-Forwarded-For=的字段a.a.a.aX-Forwarded-For报头由omiting LB IP( b.b.b.b)和变化$remote_addr,从b.b.b.b以a.a.a.a这样proxy_set_header X-Real-IP $remote_addr成真(OK这就是我想要的!) X-Forwarded-For报头与a.a.a.aIP代替b.b.b.bX-Forwarded-For= a.a.a.a, a.a.a.aX-Real-IP= a.a.a.aX-Forwarded-For应该是a.a.a.a, b.b.b.b 我需要的是能够先设置proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for然后搜索真实IP并替换$remote_addr值. …
将组件发布到Nexus存储库时遇到问题,Maven上传文件两次:
我使用以下命令启动打包/部署(请参阅底部的pom.xml文件):
mvn clean package deploy:deploy-file -e -f pom.xml
这是处理部署阶段时maven输出控制台的片段(6个第一行是正确的,但注意到最后两行有pom groupId/artifactId/version):
[INFO] --- maven-deploy-plugin:2.8.2:deploy-file (default-cli) @ assemblage-playbook ---
Uploading: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/1.0/COMPOSANT-A_1.0.tar.gz
Uploaded: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/1.0/COMPOSANT-A_1.0.tar.gz (2 KB at 2.7 KB/sec)
Downloading: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/maven-metadata.xml
Downloaded: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/maven-metadata.xml (321 B at 4.6 KB/sec)
Uploading: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/maven-metadata.xml
Uploaded: http://urlRepo:8080/nexus/content/repositories/snapshots/COMPOSANTS/COMPOSANT-A/maven-metadata.xml (321 B at 1.6 KB/sec)
Downloading: http://urlRepo:8080/nexus/content/repositories/snapshots/com/com.mycompany/assemblage-playbook/1.0-SNAPSHOT/maven-metadata.xml
Uploading: http://urlRepo:8080/nexus/content/repositories/snapshots/com/com.mycompany/assemblage-playbook/1.0-SNAPSHOT/assemblage-playbook-1.0-20150209.154427
Run Code Online (Sandbox Code Playgroud)
这是我的pom.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>assemblage-playbook</artifactId>
<packaging>pom</packaging>
<name>assemblage-playbook</name>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../../parent/pom.xml</relativePath>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<descriptors>
<descriptor>assembly/playbook-assembly.xml</descriptor>
</descriptors>
<finalName>COMPOSANT-A-1.0</finalName> …Run Code Online (Sandbox Code Playgroud) 以下是库存文件的示例:
[web_servers]
web_server-1 ansible_ssh_host=xxx ansible_ssh_user=yyy
[ops_servers]
ops_server-1 ansible_ssh_host=xxx ansible_ssh_user=zzz
Run Code Online (Sandbox Code Playgroud)
此外,web_servers小组在group_vars/web_servers以下方面有特定的变量:
tomcat_jmx_port: 123456
Run Code Online (Sandbox Code Playgroud)
tomcat_jmx_port处理时如何访问var ops_servers?
有些人可能会说我需要一个all共同代理小组(比如)来放置常见的变量,但这仅仅是一个例子,在真实的生活中有很多我想要访问的变量ops_servers,我想保持清晰,所以tomcat_jmx_port必须留在web_serversgroup_vars文件.
实际上,我需要一种本地查找.
还有什么想法?
谢谢你的帮助.
我正在尝试通过Eclipse Helios的Google App Engine插件在本地创建一个简单的Hello World.当想要使用eclipse工具启动服务器时出现问题(在我的项目上运行右键 - >运行方式 - > Web应用程序),控制台始终显示以下日志:
2012-04-17 19:01:09.126 java[4019:407] [Java CocoaComponent compatibility mode]: Enabled
2012-04-17 19:01:09.127 java[4019:407] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Usage: <dev-appserver> [options] <war directory>
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种始终运行角色的方法,而不管--tags参数如何。
这是一个简单的剧本:
- hosts: all
roles:
- { role: role1, tags: always },
- { role: role2, tags: tag1 },
- { role: role3, tags: tag2 }
Run Code Online (Sandbox Code Playgroud)
当我启动以下过滤器(而不是 only )时,我只想运行role1并role2运行role2:
ansible-playbook -i hosts deploy.yml --tags tag1
Run Code Online (Sandbox Code Playgroud)
我虽然这是带有特殊always标签的默认行为(请参阅http://docs.ansible.com/ansible/playbooks_tags.html#special-tags)
我正在玩 Ansible 1.8.4。
我问自己为什么Ansible 在一个主机上~/.profile执行template模块之前不提供文件?
远程主机~/.profile:
export ENV_VAR=/usr/users/toto
Run Code Online (Sandbox Code Playgroud)
一个简单的Ansible任务:
- template: src=file1.template dest={{ ansible_env.ENV_VAR }}/file1
Run Code Online (Sandbox Code Playgroud)
Ansible失败,原因:
fatal: [distant-host] => One or more undefined variables: 'dict object' has no attribute 'ENV_VAR'
Run Code Online (Sandbox Code Playgroud) 我正在寻找一种解决方案,以检查集合中的每个项目都具有expectedNullFieldnull 字段。
以下内容不起作用:
assertThat(aCollection).extracting("expectedNullField").isNull();
请注意以下工作正常:
assertThat(aCollection).extracting("expectedNotNullField").isNotNull();
有人帮我吗?
谢谢。
我正在寻找一种方法,让UITableViewController在顶部有一个UITableView,一个UIPickerView在下面(有修复位置).
我找到了一个解决方案,用以下代码修复选择器:
- (void)viewDidLoad {
[super viewDidLoad];
_picker = [[UIPickerView alloc] initWithFrame:CGRectZero];
_picker.showsSelectionIndicator = YES;
_picker.dataSource = self;
_picker.delegate = self;
// Add the picker to the superview so that it will be fixed
[self.navigationController.view addSubview:_picker];
CGRect pickerFrame = _picker.frame;
pickerFrame.origin.y = self.tableView.frame.size.height - 29 - pickerFrame.size.height;
_picker.frame = pickerFrame;
CGRect tableViewFrame = self.tableView.frame;
tableViewFrame.size.height = 215;
self.tableView.frame = tableViewFrame;
[_picker release];
}
Run Code Online (Sandbox Code Playgroud)
问题是与tableview,似乎调整大小不起作用,所以我看不到所有的结果.
谢谢你的建议.
我的应用程序我有一个application-context.xml.现在我将ApplicationContext实例化为:
ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");
Run Code Online (Sandbox Code Playgroud)
是否可以通过此实例化传递参数,以便这些参数可用于初始化某些bean的某些属性?
PS:不使用属性文件.由于参数是生成运行时间,如可解决的jar的位置,系统架构,os名称等是可变的.
我使用Spring启动(1.3.0)与泽西岛(POM依赖关系:spring-boot-starter-jersey,spring-boot-starter-actuator,spring-boot-starter-web,spring-boot-starter-security).
我有一个Jersey端点(见下文),这非常简单:
@Component
@Path("/helloworld")
public class HelloWorldResource {
@GET
public String home() {
return "Hello World !";
}
}
Run Code Online (Sandbox Code Playgroud)
我通过为Spring MVC url(server.servlet-path=/system)设置特定路径来启用Spring Boot Actuator ,如Spring Boot指南中所述.
由于spring-boot-starter-security,Actuator端点通过基本身份验证得到保护.
我的问题是,这/helloworld也是安全的,但我想让它不安全.
我怎样才能做到这一点 ?
谢谢 !
我想知道是否可以使用git自动pull --rebase进行操作git push?
我的意思git push是,如果被拒绝,自动做一次git pull --rebase,然后git push再次,所以我不需要每次有人在我面前推动手动.
谢谢你的回答.