日期:2011-02-23 18:06:00  来源:本站整理

Linux下Nginx配置示例及Nginx/PHP/MySQL简单管理脚本[服务器安全]

赞助商链接



  本文“Linux下Nginx配置示例及Nginx/PHP/MySQL简单管理脚本[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:

1,Linux下Nginx主配置文件及FasgCGI配置文件
nginx.conf
==========================
user www www;
worker_processes 8;
worker_rlimit_nofile 51200;

error_log /root/workspace/logs/nginx/error.log;


#error_log logs/error.log notice;
#error_log logs/error.log info;


pid logs/nginx.pid;


events {
use epoll;
worker_connections 51200;
}


http {
include mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;

#keepalive_timeout 0;
keepalive_timeout 65;

gzip on;
gzip_types text/plain text/css application/x-javascript application/xml;

fastcgi_connect_timeout 500;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_intercept_errors on;

server {
listen 80;
server_name www.linuxidc.net;
index index.html index.php;
root /root/workspace/htdocs;

access_log /root/workspace/logs/nginx/host.access.log main;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location ~ \.(gif|jpg|jpeg|png|swf|bmp)$ {
expires 30d;
}

location ~ \.(css|js)$ {
expires 1h;
}

#charset koi8-r;

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root html;
#}

# proxy the PHP script to Apache listening on 127.0.0.1:80
#
#localtion ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

server {
listen 80;
server_name www.linuxidc.com;
index index.html index.php;
root /root/workspace/mysql;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ \.(gif|jpg|jpeg|png|swf|bmp)$ {
expires 30d;
}

location ~ \.(css|js)$ {
expires 1h;
}
}

#another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}fastcgi_params
========================================================================
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;


fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;


fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;2,Nginx + PHP + MySQL简易管理Shell脚本
nginx
========================================================================
#!/bin/bash

function_start_nginx(){
printf "Starting Nginx ...\n"



  以上是“Linux下Nginx配置示例及Nginx/PHP/MySQL简单管理脚本[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
  • windows下的近似linux下的grep号令--findstr
  • linux下mysql链接被防火墙禁止的办理办法
  • Linux下mysql新建账号及权限设置办法
  • SUSE Linux下搭建Web服务器
  • Windows/Linux MySQL忘掉密码重置密码教程
  • Linux下Apache自动监测重启脚本(智能化程度较高)
  • linux备份 linux克隆 linux clone
  • <b>为什么 Linux不需求碎片整理</b>
  • CentOS6 yum搭建Linux+Nginx+PHP+MYSQL(LNMP)
  • Linux系统有效防备ARP攻击
  • Linux下 Memcache的安装和简单管理
  • 笔记本预装linux重装成windows系统
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .