# a2enmod expires
# a2enmod deflate
# vi /etc/apache2/sites-available/example.com.conf
# gzip html, css and js
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript
#启用过期header功能
ExpiresActive On
#缺省过期时间为“访问后的1天”
ExpiresDefault "access plus 1 days"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/vnd.microsoft.icon "access plus 1 months"
ExpiresByType image/x-icon "access plus 1 months"
ExpiresByType image/ico "access plus 1 months"
ExpiresByType application/javascript "now plus 1 months"
ExpiresByType application/x-javascript "now plus 1 months"
ExpiresByType text/javascript "now plus 1 months"
ExpiresByType text/css "now plus 1 months"
分类归档:Linux
Apache配置cookie的HttpOnly属性
# vi /etc/apache2/sites-available/example.com.conf
Header set Set-Cookie HttpOnly;Secure
Apache X-Frame-Options配置
X-Frame-Options
HTTP 响应头是用来给浏览器指示允许一个页面可否在 <frame>
, <iframe>
或者 <object>
中展现的标记。网站可以使用此功能,来确保自己网站的内容没有被嵌到别人的网站中去,也从而避免了点击劫持 (clickjacking) 的攻击。
X-Frame-Options有三种可配置值
X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN
X-Frame-Options: ALLOW-FROM https://example.com/
DENY
表示该页面不允许在 frame 中展示,即便是在相同域名的页面中嵌套也不允许。
SAMEORIGIN
表示该页面可以在相同域名页面的 frame 中展示。
ALLOW-FROM uri
表示该页面可以在指定来源的 frame 中展示。
注: 在网页中设置meta标签是无用的!例如,<meta http-equiv="X-Frame-Options" content="deny">
是没有效果的。不要使用这种方式。需要在下面的配置实例中配置HTTP Header的方式来进行配置,X-Frame-Options
才会起作用。
# a2enmod headers
# vi /etc/apache2/sites-available/example.com.conf
Header always append X-Frame-Options SAMEORIGIN
Header set X-Frame-Options DENY
Header set X-Frame-Options "ALLOW-FROM https://example.com/"
# service apache2 restart
Hive常见操作命令
1. hive模糊搜索表
show tables like ‘*name*’;
2. 查看表结构信息
desc formatted tablename;
desc table_name;
3. 查看分区信息
show partitions tablename;
4. 根据分区查询数据
select table_coulm from tablename where partitionname = ‘2016-02-25’; 阅读全文…
ubuntu 16.04升级php7.0至7.2
直接命令升级
1. apt-get update && apt-get upgrade
2. apt-get install software-properties-common
3. add-apt-repository ppa:ondrej/php
4. apt-get update
5. apt-get upgrade php
升级后安装对应的扩展
apt-get install php7.2-mbstring
apt-get install php7.2-gd
apt-get install php7.2-mysql
apt-get install php7.2-curl
查看已安装的php包
dpkg -l | grep php
删除旧版本
sudo apt-get purge php7.0 php7.0-common
# 查看php版本
php -v
Ubuntu 常用查找文件与文件内容指令
在Linux服务器(ubuntu)上使用Apache为odoo openerp配置域名
How to Install a LAMP Stack on Ubuntu 16.04
A LAMP (Linux, Apache, MySQL, PHP) stack is a common, free and open-source web stack used for hosting web content in a Linux environment. Many consider it the platform of choice on which to develop and deploy high-performance web apps.
This guide shows how to install and test a LAMP stack on Ubuntu 16.04 (LTS). 阅读全文…