lnmp 涂鸦

<directory /data/www/mmm>
allowoverride none
options none
order allow,deny
allow
</directory>
<filesmatch "(.*)php(.*)">
order allow ,deny
allow from all
<filesmatch>
禁用useragent
rewritecond %{http_user_agent} ".*curl.*"[nc,or]
rewritecond %{http_user_agent} ".*chrome.*"[nc]
rewriterule .* - [f]

禁止解析php
php_admin_flag engine off
rewritecond %{request_uri} ^.*/data/www/mmm

php-fpm的配置文件:
[global]
pid=/usr/local/php/var/run/php-fpm.pid
error_log=/usr/local/php/var/log/php-fpm.log
[www]
listen=/tmp/www.sock
listen.owner=nobody 解决502问题
listen.group=nobody 解决502问题
user=php-fpm
group=php-fpm
pm=dynamic
pm.max_children=50
pm.start_servers=20
pm.min_spare_servers=6
pm.max_spare_servers=35
pm.max_requests=500
rlimit_files=1024
slowlog=/tmp/slow.log
request_slowlog_timeout=1
php_admin_value[open_basedir]=/data/www:/tmp
新建网站的文件存放处:
server {
       listen 80;
       server_name cisco.com;
       index index.html index.htm index.php;
       root /data/www;
location ~\.php$ {
       include fastcgi_params;
       fastcgi_pass unix:/tmp/www.sock;
       fastcgi_index index.php;
       fastcgi_param SCRITP_FILENAME /data/www$fastcgi_script_name;

}
}
常见的502错误:在php-fpm配置文件中加
               listen.owner=nobody
               listen.gruop=nobody
php-fpm.conf的配置文件:检测网站性能
                       slowlog=/tmp/slow_log
                       request_slowlog_timeout=1

虚拟配置文件的用户认证:location ~.*admin\.php$ {
                                 auth_basic "cisco"
                                 auth_basic_user_file /usr/local/nginx/conf/ps.ps;
                                 include fastcgi_params;
                                 fastcgi_pass unix:/tmp/www.sock;
                                 fastcgi.index index.php;
                                 fastcgi-param script-filename /tmp/www&fastcgi_script_name;
}

虚拟配置文件301 的跳转: if ($host != ‘www.swcaac.com‘)
                    {
                      rewrite ^/(.*)$ http://www.swcaac.com/$1 paramanent;
}
1.9 指定不记录文件的类型:
1。在nginx.conf中修改日志名:如cisco
2。在虚拟配置文件中加入:access_log /tmp/access_log cisco;
location ~.*\.(png|gif|jpeg|swf|bmp|jpg)$
{
access_log off;
}
location ~(static|cache)
{
access_log off;
}
2.0 nginx的日志切割脚本:
1.找好脚本存放的地方/etc/logrotate.sh
2.写脚本。vi /etc/logrotate.sh
!#/bin/bash
d=`date -d "-1 day" +%f`
[ -d /tmp/nginx_log ] || mkdir /tmp/nginx_log
mv /tmp/cisco.log /tmp/nginx_log/$d.log
/etc/init.d/nginx/reload > /dev/null
cd /tmp/nginx_log/
gzip -f $d.log
2.1 nginx 配置静态文件的过期时间
在指定不记录文件类型中添加
access_log off;
expires 2d;
location ~ \.(js|css)
{
access_log off
expires 2h;
}
2.2nginx 的防盗链接
1.在静态缓存文件下加入:valid_referers none blocked *.swcaac.com *.cisco.com;
if ($invalid_referer)
{
return 403;
}
                  curl -e 指定你的referer
 
2.3nginx的访问控制

1.在全局模式下:deny ip/地址段;表示不允许地址访问目录
2.在目录认证模式下加:allow ip;deny all; 表示目录只允许指定的ip访问

2.4nginx的user-agent禁用
if ($http_user_agent ~* ‘curl|baidu|sina|360‘)   ~*表示不区分大小写
{
return 403;
}
2.5 nginx的代理  多个地址
vim proxy
upstream cisco {
server 代理服务器ip;
server 代理服务器ip;
}
server {
listen 80;
server_name 代理服务器;

location / {
proxy_pass http://cisco/;
proxy_set_header host $host;必须和多个代理服务器ip;连用
proxy_set_header x-real-ip $remote_addr;可有可无
}
}
nginx的代理   单个ip
server {
listen 80;
server_name 代理服务器;

location / {
proxy_pass http://cisco/;
#proxy_set_header host $host;必须和多个代理服务器ip;连用
}
}

key_buffer_size = 384M
log-bin 用于主从复制 记录数据库操作记录
server-id =1 用于主从复制
关闭innodb是一种数据库引擎。
apache的三种模式
prefork 小访问量
worker 大访问量
event

ldd查看加载的模块是否正常

时间: 2024-08-08 22:37:46

lnmp 涂鸦的相关文章

linux运维、架构之路-Lnmp架构部署

一.Lnmp架构原理 二. Lnmp架构软件安装 1.Nginx安装脚本 #!/bin/bash useradd -s /sbin/nologin -M www mkdir -p /server/tools/ cd /server/tools/ wget http://nginx.org/download/nginx-1.10.3.tar.gz tar xf nginx-1.10.3.tar.gz yum install pcre-devel openssl-devel -y cd /home/

lnmp脚本

#!/bin/bash#Function: Install LNMP#Author: wang#Date: 20170809 nginx_install(){useradd www -u 509 -s /bin/bash -mmkdir -p /opt/server/nginx/temp #Install the make GCCyum -y install gcc gcc-c++ automake autoconf libtool make #Installing PCRE library (

LNMP编译安装遇到问题归总

LNMP编译安装遇到问题归总 1.错误:configure: error: freetype-config not found. 解决:yum install freetype-devel 2.错误:configure: error: libevent >= 1.4.11 could not be found  解决:yum -y install libevent libevent-devel 3.错误:configure: error: Please reinstall the mysql d

Python实现一键安装部署LNMP环境

最近一直在学Python,东西比较多,时间持续的也比较长,为了能够学以致用,想到了原来写过的shell一键安装部署LNMP脚本,既然shell能写,Python也一定能写,就用学到的知识写了下面这个版本,这可能并不是最优版本,等学到更多东西的时候再进行优化升级! 环境介绍: Python 2.6.6 Centos 6.5 nginx 1.10.1 mysql 5.6.34 php 5.3.3 代码如下: #!/bin/env python import os import sys def ent

lnmp平台的简单基础搭建

一.mysql的安装: 1. get mysql-boost-5.7.17.tar.gz (from 老吴) 使用mysql-boost-5.7.17.tar.gz时,查看df -h,物理空间应该大于10G tar zxf mysql-boost-5.7.17.tar.gz##解压mysql,会发现解压完后du -sh是500+M 2. 软件包依赖性: 在cmake过程中需要使用到gcc.gcc-c++编译器.ncurses-devel.cmake yum install -y gcc gcc-

0123简单配置LNMP

简单配置LNMP不怕出现错误,就怕错误不知道出现在哪里?看日值tail -f /var/log/message -- 系统整个的日志tail -f /var/log/nginx/error.log -- 单个应用的日志http://www.cnblogs.com/make217/p/5836864.htmlhttp://www.cnblogs.com/xiaoit/p/3991037.html

搭建lnmp环境,部署php动态网站

搭建LNMP 前言:"N"代表Nginx与apache的作用一样,都是为了搭建网站服务器,由俄罗斯人lgor sysoev开发,其特点是占有内存少,并发能力强,单台物理服务器可支持3万-5万个并发请求,中国使用nginx网站用户有:百度.京东.新浪.网易.腾讯.淘宝等. 通过下面的实验搭建LNMP环境,部署天空影城的php动态网站 本实验在虚拟机中运行,使用Redhat6.5系统部署! 一.安装及运行 1.搭建yum仓库,安装支持软件 nginx的配置及运行需要pcre,zlib等软件

centos6 LNMP的搭建(linux+nginx+mysql+php)

LNMP的搭建(linux+nginx+mysql+php) 简介 LNMP代表的就是:Linux系统下Nginx+MySQL+PHP网站服务器架构. Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统.代表版本有:debian.centos.ubuntu.fedora.gentoo等. Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器. Mysql是一个小型关系型数据库管理系统. PHP是一种在服务器端执行的嵌入HTML文档

NGINX网站服务-LNMP平台及应用

实验需求: LNMP实现多个虚拟主机,部署wordpress和phpmyadmin,并为phpmyadmin提供https 实验环境: LNMP                 CentOS 7.2x86_64            IP:172.16.251.138 测试端              CentOS 6.7x86_64            IP:172.16.251.164 实验准备: 安装开发包组,支持软件,解决依赖关系 [[email protected] ~]# ipta