分类 http/html/web articles

Deny Hosts Using Nginx

I was noticing my nginx log file fill up with requests for a site who had misconfigured their DNS. Normally I wouldn’t worry about it, but it became quickly evident that the domain was used for an image server for a parent site. There were thousands of RPS that I really didn’t need. All I did was add the following expression to my nginx.conf file. 1Server { 2 ...snip... 3 ## Deny illegal Host headers 4 if ($host !~* ^(mydomain.com|www.mydomain.com)$ ) { 5 return 444; 6 } 7 ...snip... 8} Now if you look at the code, you may be thinking “But Jared, what is a 444 error? That is totally not valid bro.” And indeed, you are correct. But here is what the nginx documentation has to say about it. _“Furthermore, nonstandard code 444 closes the connection without sending any headers.……

Continue reading

使用nginx进行cache缓存

一、nginx cache配置 1、nginx.conf 主配置文件 这个基本按默认配置做的,如果是生产环境可以再加上只允许通过的域名访问,不允许的403或转到其他页。另外进程数和连接数也要做相应修改。 1worker_processes 1; 2events { 3 worker_connections 1024; 4} 5http { 6 include mime.types; 7 default_type application/octet-stream; 8 sendfile on; 9 keepalive_timeout 65; 10 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 11 '$status $body_bytes_sent "$http_referer" ' 12 '"$http_user_agent" "$http_x_forwarded_for"'; 13 access_log logs/access.log main;……

Continue reading

利用shell生成站点地图

一些以静态页面为主的站点,可能不方便的没有生成sitemap 。而为了加快搜索引擎的收录,最好能主动做好sitemap,通过站长工具提交或写入robots文件,这样能加快百度、google等的收录。下面以百度sitmap为例, 通过shell实现的代码如下: <pre class="prettyprint linenums lang-bsh">cd /data/www find . -name *.htm > site.txt sed -i……

Continue reading

使用ssl_session_cache优化https下Nginx的性能

网站启用https后,会加剧服务器的负担。每次新的TLS连续都需要握手,以便创建共享的加密密钥,在TCP三次握手之上还需要两个来回。传统的http使用TCP三次握手建立连接,而SSL和TLS在这个基础上还需要9个握手包,所以这个负担显而易见。不过,通过重用Session提高htt……

Continue reading

Nginx伪静态规则大全(wordpress/discuz/ecshop/phpwind/dedecms)

Nginx一个非常高效的HTTP服务器软件,虽然在使用上很高效、稳定、快速,但是唯一的缺点就是伪静态规则比较复杂,很多新手使用Nginx总是被伪静态规则难倒了,下面我提供一下目前常见各种网站程序的Nginx伪静态规则,希望能帮到大家。 建议大家在下面找到自己需要的伪静态规则,然后保……

Continue reading

Apache和Nginx下禁止访问特定的目录或文件

出于安全考虑,在apache上经常需要做规则限制,禁止访问某些目录。但是假如别要知道该目录下某些文件名,还是可以访问这些文件的。如,禁止了test目录的访问,打开http://www.domain.com/test/时访问会报403错误 。不过如果该test下有passwd.txt……

Continue reading

centos 6.x下jira显示饼图乱码

近期由于KVM迁移,把原先jira的一套软件也由原来物理机迁移到了虚拟机上。操作系统版本也由centos5换成了centos6.4 ,jira同时也做了次升级,换成了jira v6.0.7 。安装完成并打上了中文语言包,一切正常。不过后面在使用过程中,发现饼图显示为口口这样的乱码 。 网上查询到的方……

Continue reading

logrotate进行nginx的日志轮转

logrotate是linux下自带的日志轮询工具。默认情况下,在/etc/cron.daily/目录下有一个logrotate脚本,我们只要把nginx的轮询脚本放在/etc/logrotate.d/下即可。 1# cat /etc/logrotate.d/nginx 2/usr/local/nginx/logs/*.log { 3daily 4missingok 5rotate 7 6compress 7delaycompress 8notifempty 9sharedscripts 10postrotate 11 kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` 12endscript 13} 注:同样可以发送HUP信号来……

Continue reading

nginx cache查看命中率

nginx在web应用上的占用率越来越高,其带的模块也越来越来。nginx_cache算是一个,虽和专业的cache工具相比略逊一筹,但毕竟部署简单,不用另装软件和资源开销,所以在web cache中也占了比重不小的一席。不过像squid和varnish等cache软件都自带的有c……

Continue reading

Tomcat Native的安装

Tomcat Native 这个项目可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO操作,以提升性能。其项目下载主页为:http://tomcat.apache.org/download-native.cgi 。默认在下载的tomcat里的bin目录带的有该项目的tar包 。 一、安装 tomcat native的安装需要依赖……

Continue reading

Latest articles

Categories

Tags

ACL AD AES AI Alpine Android Anpic Ansible Apache Apm Apparmor Appfog Apr Apt-Get Aria2 Array Atlassian Atop Audit Awk AWS Awstats Axel Azure Backdoor Backup Bamboo Bash Bat Benchmark Bigdata Bin Bind Bitwise Blockchain BMC Book Bootstrap Brocade Bsd C1000 Cache Capistrano Catlog CDH5 Centos Centos7 Chatops Chattr Check_mk Checkinstall Cisco CL210 Clickhouse Cloud Cloud-Desktop Cmdb Cms Cobbler Collectd Comm Compress Confd Conver Corosync Cpu Crontab Crunchbang Css Curl C语言 Date DDOS Decode Dell Desktop Devops Df Dhcp Diff Diskpart DISTINCT Django DNS Docker Dos2unix Dpkg Drupal Duckdb EKS ELK Etcd Excel Fail2ban Fastcgi Fdisk Fiddler Find Firewalld Flask Flvtool Ftp Function Fuser GCP Geek Ghost Gin Git Github Gitlab Glances Glusterfs Go Godaddy Golang Google Gooupadd Grafana Graphviz Gravatra Grep Grub2 Hadoop Haproxy Hardware HBA HCIE Heartbeat Helm Hexdump Hhvm History Hotspot Html Http/Html/Web Http/Html/Web Httplogs Https HttpWatch Huawei Huaweicloud Hugo IBM Icmp Iconv Ifconfig IIS InfluxDB Ingress InnoDB Inotify Iopp IOS Ipmitool Iptables Iredmail Iscsi Isito It-News Java JavaScript Jdk Jenkins Jinja2 Jira Join Joomla K3s K8s Kdump Keepalived Kernel Kingate KVM Lamp Last Leetcode Lib Linux Linux高级篇 Ln Ls Lsi Lsof Lvm Lvs Mac Mail Man Mark Markdown Matplotlib Maven Memcached Microservice Mimikatz Mkdocs Mkpasswd Mmonit Mod_jk Mongodb Monit Monitor Mono Moodle Mosh Mount Mplayer Mpm Mrtg Mtr My.cnf Mysql Mysqlbinlog Mysqld_multi MySQLdb Mysqldump Mysqlhotcopy Nagios Nc Nethogs Netlify Nexus Nfs Nginx Nmon Nocatlog Node.js Nrpe Ntfs Ntop Ntp Obs Ocr Open-Falcon Openbox Opencv Openldap OpenResty Openssl Openstack Oracle Oswatch Paas Pacemaker Pam Pandas Parted Pcp Pcre Pdf Percona Perl Pexpect Pgrep Php Php-Fpm Ping Plsql Develope PM Postfix PostgreSQL Powershell Prettify Proc Prometheus Puppeteer Pushd Pwgen Pxe Pyecharts Python Python模块 QoS Radmin Raid Rdesktop Read Redhat Redis Redmine Regex Rh134 RH318 RH442 RHCA RHCE Rhel7 Rhel8 RHEV Rm Rman Rootkit Route Rpm Rpmforge Rrdtool RSA Rsync Rsyslog Safe Saltstack Samba Scapy Screen SecureCRT Sed Selenium Selinux Seo Seq Session Set Shc Sheepdog Shell Shopt Sitemap Skydns Smokeping Snffier Snmp Socket Soft Sort Spider Sql Sqlserver Squid SRE Ss Ssh Sshpass Statuscode Strace Strings Su SublimeText2 Sudo Suse Svn Sysbench Syslog-Ng Sysstat Systemd T Tar TC Tcpcopy Tcpdump Tech Telecom Telnet Tencentcloud Tengine Test Testlink Threads Time Tmux Tomcat Touch Tr Tsar Twisted Ubuntu Udev Ulimit Unix Unixbench User-Agent Useradd Varnish VBA Vbs Vercel Vi Vim Visudo Vmstat Vmware Vnc Voice Vpn Vscode Vsftp Vsftpd Vue Watchdog Web Webcam Webistrano Wget Wiki Windows Wol Wordpress Workshop Wsl X-Windows Xampp Xcache Xmllint Xtrabackup Yule Yum Zabbix Zeromq Zip Zonetime Zookeeper 下载工具 云主机 云原生 代理 加密 古意 吐槽 圈里圈外 娱乐 字符串函数 安全 平台架构 推理 提权 故事汇 故障案例 数据结构 每日看点 民国史 生活 科学记录 站长管理工具 算法 管理 网站架构 翻墙 股票 行业 诗韵 负载均衡 远程管理 面试题

Links

Meta