Category Archives: DevOps

Enable https for your apache-httpd-hosted website with a self-signed certificate

Generate a self-signed https certificate Java’s KeyTool is kind of heavy due to its “keystore” concept. I prefer openssl: openssl req -x509 -nodes -newkey rsa:2048 -keyout cjx_private.key -out cjx_cert.pem -days 36500 #”-nodes” means no password to access the certificate file # You will be prompted set up your information. This one is important: Common Name […]

ec2中搭建服务后要编辑一下security group才能让外网访问

在aws ec2中搭建apache httpd或tomcat后,发现使用ec2 instance的public ip在浏览器里访问相关服务时失败。 这是因为防火墙未设置。对ec2来说,security group就相当于防火墙。 设置办法: 进入instance列表,在security group列中找到对应的group, 点击它,然后Actions => Edit Inbound Rules, 加入http, 即可允许80端口访问。 如果要打开8080的http端口,新增一个custom tcp rule.

.htaccess被忽略了?

看看你的virtual host是不是有这个错误: 引用 <Directory "/home/page_url/www/">     AllowOverride None 你要去掉AllowOverride None. 如果 apache版本较低,还要加上AllowOverride All 引用 Syntax: AllowOverride All|None|directive-type [directive-type] … Default:AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier) http://stackoverflow.com/questions/5210820/apache-server-ignores-htaccess

apache httpd: A typical virtualhost

引用 <VirtualHost myjoomla.kent.net:80>         ServerName myjoomla.kent.net         DocumentRoot /home/kent/dev/phpws/joomla25         <Directory />                 Options FollowSymLinks                 AllowOverride None         </Directory> </VirtualHost>

eclipse + tomcat + maven 集成开发环境

eclipse + tomcat + maven 集成开发环境,满足:    1.对jsp的修改直接生效    2.改好代码后只需要点击启动tomcat,不需要执行mvn package等命令    网上搜了半天,完整的解决方案是:    0. eclipse要用jee版,并装好m2eclipse插件    1. 按 这个配置dynamic web module,将web root配成 src/main/webapp.    2. 在server窗口里新增tomcat并且将刚才的工程加进去。tomcat可能要7.0才行,具体版本 见: 这里    3. 设置context path为你想要的,否则context path将与你的project同名。 Project Properties => Web Project Settings => Context Root    4. 将maven所指向的依赖库纳入web module, 否则会报找不到类的错误.  Project Properties => Deployment Assembly => Add […]

apache httpd禁止直接用IP访问

搜了半天,最后按下面这种方法搞定的: (不用xml做配置文件的系统都是耍流氓,像httpd.conf这种东西的层次感太不明确了) 引用 NameVirtualHost *:80 <VirtualHost *:80>         ServerName 111.111.111.111         <Location />            Order deny,allow             Deny from all         </Location> </VirtualHost> <VirtualHost*:80>         ServerName www.myblog.com         DocumentRoot /home/me/myblog         …        </VirtualHost>