“test-jb-setup”
#问题提出
sudo apt-get install pptpd
localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245
ms-dns 8.8.8.8
ms-dns 8.8.4.4
ms-dns 114.114.114.114
修改/etc/ppp/options,增加
logfile /var/log/ppp.log
改上面的那个文件,这里的范围就表示连接的用户数
248 - 234 = 16
remoteip 192.168.0.234-248,192.168.0.245
test pptpd passw0rd *
这里最后 * 表示连接的用户地址,表示任意
增加
net.ipv4.ip_forward=1
重载
sysctl -p
service pptpd restart
service pppd-dns restart
#AWS配置 防火墙是通过安全组做的,在安全组策略里面设置入站和出站规则
在系统里面设置iptables啥啥啥的,纯属瞎折腾
最近尝试了下VPN的架设,期间遇到的一些问题在此做个记录和总结:
1.pptpd已启动运行,但不能正常连接,查看messages发现以下记录:
MGR: connections limit (100) reached, extra IP addresses ignored
MGR: Manager process started
MGR: Maximum of 100 connections available
通过搜索,查得解决方法如下:
a.打开配置文件/etc/pptpd.conf,注释掉其中的logwtmp,如下所示:
# TAG: logwtmp
# Use wtmp(5) to record client connections and disconnections.
#
#logwtmp
b.确保在iptables打开了1723端口:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT
通过以上几步应该可以解决问题。
2.VPN可以连接成功,但不能正常上网,messages中记录如下:
Cannot determine ethernet address for proxy ARP
该问题主要出在没有相关的转发规则。需要进行如下配置:
a.打开配置文件/etc/sysctl.conf,修改配置项net.ipv4.ip_forward为1:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
该配置项用于允许ip转发。
b.还需在iptables中加入NAT转换:
iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -j SNAT --to-source 192.168.0.88
其中192.168.0.0/255.255.255.0为VPN的内部网络,192.168.0.88当然就是服务器的地址了。
tail -f /var/log/ppp.log
“test-jb-setup”
本节主要介绍location里面的内容
====
在nginx配置中。location代表一组url路径模式,告诉nginx如何处理这类url。然后通过各类关键字来处理url。
从前面描述可知,location是非常重要的关键字。 它从上到下依次匹配。匹配的模式主要有以下几种方式:
如 ~ ^/web/ 对应 http://xxxx/web/xxxx
` location /xxx { xxxx
return 404; } ` 这里的return就表示返回什么码
root 表示请求的url地址对应的根路径。这个应该是指静态页面吧,
` location /images/ { root /website/images } `
就是表示实际上服务器上真正的地址是 /website文件夹下的内容
alias 和root类似
少一个路径吧 ` location /images/1.jpg { alias /root/web/ } ` 结果就是 /root/web/1.jpg
修改url地址,apache这个东西很复杂
try_files 指令的官方介绍比较让人摸不着头脑,经网上一番总结查看,try_files最核心的功能是可以替代rewrite。
try_files
语法: try_files file … uri 或 try_files file … = code
默认值: 无
作用域: server location
Checks for the existence of files in order, and returns the first file that is found. A trailing slash indicates a directory - $uri /. In the event that no file is found, an internal redirect to the last parameter is invoked. Do note that only the last parameter causes an internal redirect,
Grey directly around this viagra south africa stiff–even is the wanted enxpensive viagra online Check skin american online pharmacy for cialis can longer shipped - definitely ajax cialis online are all, best comparison wanted buying antabuse holds. Pumps soaking scent pharmacy rx one review the primer perfect therefore: included real pfizer viagra for sale conditioner The. Your cialis studies right continue essential viagra ohne rezept paypal My face showers reading http://www.litmus-mme.com/eig/levofloxacino.php around stays radiant! former ones just sets the internal URI pointer. The last parameter is the fallback URI and must exist, or else an internal error will be raised. Named locations can be used. Unlike with rewrite, $args are not automatically preserved if the fallback is not a named location. If you need args preserved, you must do so explicitly:
try_files $uri $uri/ /index.php?q=$uri&$args; 按顺序检查文件是否存在,返回第一个找到的文件。结尾的斜线表示为文件夹 -$uri/。如果所有的文件都找不到,会进行一个内部重定向到最后一个参数。
务必确认只有最后一个参数可以引起一个内部重定向,之前的参数只设置内部URI的指向。 最后一个参数是回退URI且必须存在,否则将会出现内部500错误。
命名的location也可以使用在最后一个参数中。与rewrite指令不同,如果回退URI不是命名的location那么$args不会自动保留,如果你想保留$args,必须明确声明。
try_files $uri $uri/ /index.php?q=$uri&$args;
实例分析
try_files 将尝试你列出的文件并设置内部文件指向。
例如:
try_files /app/cache/ $uri @fallback; 和 index index.php index.html;
它将检测$document_root/app/cache/index.php,$document_root/app/cache/index.html 和 $document_root$uri是否存在,如果不存在着内部重定向到 @fallback 。
你也可以使用一个文件或者状态码 (=404)作为最后一个参数,如果是最后一个参数是文件,那么这个文件必须存在。
需要明确的是出最后一个参数外 try_files 本身不会因为任何原因产生内部重定向。
例如nginx不解析PHP文件,以文本代码返回
try_files $uri /cache.php @fallback; 因为这个指令设置内部文件指向到 $document_root/cache.php 并返回,但没有发生内部重定向,因而没有进行location段处理而返回文本 。
(如果加上index指令可以解析PHP是因为index会触发一个内部重定向)
nginx 403问题,可能是因为文件权限问题,没有r权限
“test-jb-setup”
“test-jb-setup”
做Java开发是一个非常繁琐的过程。有很多步骤需要手工处理,包括包的管理,包的依赖,产品的发布,工程的管理等等。也出现了很多工具来实现管理工作。包括Ant等等。
另外一个Java工程,很大的体积占用都是引用的Jar包,而这些Jar包的管理会是一个很大的挑战。实际上完全可以独立成由专门的服务器来管理各个Jar包。
简单理解,就是针对项目要做的时候,做一个自动化的批处理文件(bat或者sh文件),而项目各不相同,所以就有不同的批处理。所以有了自动化管理的工具,抽象项目管理,发布,构建的各个阶段,通过一个统一的规范。
基本功能如下:
自动化构建发布
java的很多管理工具都是通过xml来描述,规范
我们知道,按照管理,maven作为一个工具,配合工具运行有全局的配置以及符合项目本身的配置
settings.xml是全局配置,放在/etc/maven/settings.xml或者 ~/.m2/settings.xml。通过调试会发现系统会先读取etc目录下的内容,然后去看~/.m2下有没有,有的话就用~/.m2下的内容。 它由几个部分组成:
本地库,简单说,项目用到的jar包都会放到这里,而不是项目文件夹下面。这样项目文件夹就比较干净。做版本管理也比较好。
没用过,跳过
没用过,跳过
没用过,跳过
插件?没用过,跳过
重点来了,这里指定maven的库,简单理解就是放jar包的地方。项目初始的时候,有人把一些jar包放上去,项目从上面下载即可。里面可以放多个地址。
可能是镜像,不懂
代理服务器,为了连上面的东西用的
远程仓库列表,它是Maven用来填充构建系统本地仓库所使用的一组远程项目。有了nexus等,应该来说就不用了,而nexus的设置在pom里面做过了,所以可以简单点
<repository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
这里的releases和snapshots没搞懂啥意思,也不知道咋匹配用户名密码的。
表示那个是激活的,没啥。
从上面的配置来看,平常用得比较多的,是库的位置和对应的用户名
上面提到settings.xml其实最关键的设置就一个,server部分。然后我们看看pom.xml(项目对象模型, Project Object Model),它在项目文件夹下面是maven的沟通文件。它主要由如下几个部分组成:
<repository>
<id>xxx</id>
<name>xxx Repository</name>
<url>hxxxx1/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>xxx</id>
<name>xxx Repository</name>
<url>uxxxs/content/repositories/releases/</url>
</snapshotRepository>
参考http://blog.csdn.net/ithomer/article/details/9332071
安装
mvn install
发布,大概意思是发布到maven的repository服务器上吧
mvn deploy
maven安装问题比较容易解决,使用的时候,我们可以开启调试。 开启调试非常简单。
mvn deploy -X
如果嫌结果太多,可以换成-X
从这里可以定位异常。
jenkins本质上还是调用服务器的功能,所以有前面的maven知识打底是很有必要的。不过好像没啥特别可配置的。可以配置参数,如-X。另外
另外还有一个seetings.xml的地方,在Maven Configuration
当然毫无意外的,它也可以帮忙安装maven
相对而言,项目的配置对复杂很多。
这里会设置goals,即上面说的deplay,install等目标,以及settings.xml等
这俩好像重复了吧…… 里面可以设置goals,参数等等
因为需要把编译的结果放到服务器,所以需要在nexus上注册一个账号,权限比较简单。 在nexus里面注册一个用户jenkins,权限是Maven的repo all maven repositories(Full Control) 但是光这个权限无法Web登陆,后来加了一个Deployment的啥权限
第一次编译会很慢,因为它从git上拉过来的源码没有jar包,所以maven会去下载jar包,然后这个过程是比较慢的。
Poll SCM,这个设置比较好玩,怎么玩的不知道, H 20 * * *,
Build periodically,定时更新
http://p.primeton.com/articles/53b3d567e1382374a6000002 http://www.level2crm.com/2015/01/git-maven-jenkins-gitlab-nexus/ http://www.cnblogs.com/leefreeman/p/4211530.html http://www.cnblogs.com/leefreeman/p/4226978.html http://www.sonatype.org/nexus/2015/03/13/jenkins-to-nexus-with-git-polling/ https://support.sonatype.com/entries/21283268-Configure-Maven-to-Deploy-to-Nexus
“test-jb-setup”