vagrant@vagrant-ubuntu-trusty-64:~$ apachectl -t -D DUMP_MODULES | grep rewrite
# 如果没有加载vagrant@vagrant-ubuntu-trusty-64:~$ a2enmod rewrite
Enabling module rewrite.
Could not create /etc/apache2/mods-enabled/rewrite.load: Permission denied
vagrant@vagrant-ubuntu-trusty-64:~$ sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart
vagrant@vagrant-ubuntu-trusty-64:~$ less /etc/apache2/mods-enabled/rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
在http.conf文件中可以引用具体的rewrite规则文件,如下
1234
RewriteEngine on
RewriteLog /var/log/www/server.rewrite.log
RewriteLogLevel 1
Include /web/conf/httpd/conf.d/rewrites.conf
去年这个话题炒得很热,一定程度上因为DHH(Rails框架的创始人)的一篇文章TDD is Dead,之后他和Uncle Bob以及我司的Martin Fowler展开了一系列的论战。这种论战过程有趣,结果没什么意思,因为大神都比较顽固,不容易放弃自己的想法,不过不论他们怎么说,"Long Live The Testing",这点是要承认的。
于是我和同事登陆到了Nexus的instance上面,一边执行上传artifact的任务,一边查看log。发现Nginx的
access log返回的是413 - Request Entity Too Large。原来,Nginx配置中client_max_body_size
这项可以限制请求的body大小,我们要上传的jar文件大概有19Mb,远超其默认的大小,所以请求出错,难怪本地也会返回java.net.SocketException.
于是,先在Nginx的配置文件的http部分添加:
1
client_max_body_size50M;
保存之后,检查Nginx配置,reload:
12345
root@aws nginx # nginx -tnginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@aws nginx # nginx -s reload
root@0b8874d6f2c8:/# vim
bash: vim: command not found
root@0b8874d6f2c8:/# apt-get install -y vim
没有vim,赶快装一个。
随之退出控制台,容器也停止运行。
12345
docker@boot2docker:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
docker@boot2docker:~$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0b8874d6f2c8 docker.cn/docker/ubuntu:14.04 "/bin/bash"15 hours ago Exited (0) About a minute ago naughty_darwin
docker@boot2docker:~$ docker start 0b8874d6f2c8
0b8874d6f2c8
docker@boot2docker:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0b8874d6f2c8 docker.cn/docker/ubuntu:14.04 "/bin/bash"15 hours ago Up 3 seconds naughty_darwin
通过docker attach命令可以重新连接到容器上。
123
docker@boot2docker:~$ docker attach 0b8874d6f2c8
root@0b8874d6f2c8:/# which vim
/usr/bin/vim
~> boot2docker up
Waiting for VM and Docker daemon to start...
....................oooo
Started.
Writing /Users/docker/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/docker/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/docker/.boot2docker/certs/boot2docker-vm/key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/docker/.boot2docker/certs/boot2docker-vm
[vagrant@bogon ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/vagrant/.ssh/id_rsa): something
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in something.
Your public key has been saved in something.pub.
The key fingerprint is:
a5:0d:9d:f7:9a:c7:55:3b:8f:d3:6e:73:92:4e:b1:aa vagrant@bogon.something.com
The key's randomart image is:
+--[ RSA 2048]----+
||| . . || . + . .||= . . o|| S . oo.|| + *o|| o B.o|| +o+o|| E....o+|+-----------------+