lighttpd(1.4.37)配置如下

  1. server.document-root = "/var/www/lighttpd/"
  2.  
  3. server.port = 8888
  4. server.username = "nobody"
  5. server.groupname = "nobody"
  6.  
  7. server.max-worker = 2
  8. server.max-keep-alive-requests =4000
  9.  
  10. server.errorlog = "/tmp/lighttpd.error.log"
  11. accesslog.filename = "/tmp/lighttpd.access.log"
  12.  
  13. server.modules = (
  14. "mod_access",
  15. "mod_accesslog",
  16. "mod_fastcgi",
  17. "mod_proxy",
  18. "mod_redirect",
  19. "mod_compress",
  20. "mod_rewrite",
  21. "mod_expire"
  22. )
  23.  
  24. var.document_root = "/usr/local/openresty/nginx/html/"
  25.  
  26. mimetype.assign = (
  27. ".html" => "text/html",
  28. ".txt" => "text/plain",
  29. ".jpg" => "image/jpeg",
  30. ".png" => "image/png",
  31. ".js" => "application/x-javascript",
  32. ".css" => "text/css"
  33. )
  34.  
  35. static-file.exclude-extensions=(".fcgi", ".php", ".rb")
  36. index-file.names = ("index.html")
  37.  
  38. dir-listing.activate = "disable"
  39.  
  40. $HTTP["host"] == "www.anotherweb.com" {
  41. server.document-root = document_root + "ci/"
  42. $HTTP["url"] =~ "^/download/" {
  43. dir-listing.activate = "enable"
  44. }
  45. url.rewrite-once = (
  46. "/(.*)\.(.*)" => "$0",
  47. "/(css|files|img|js|stats)/" => "$0",
  48. "^/([^.]+)$" => "/index.php/$1"
  49. )
  50. fastcgi.server = (
  51. ".php" =>
  52. ((
  53. "host" => "127.0.0.1",
  54. "port" => 9000,
  55. #"check-local" => "disable",
  56. #"broken-scriptfilename" => "enable"
  57. ))
  58. )
  59. } else $HTTP["host"] =~ "(.*\.|)mywebsite.com" {
  60. #server.document-root = "/usr/local/openresty/nginx/html/"
  61.  
  62. $HTTP["referer"] !~ "^($|http://.*\.mywebsite.com)" {
  63. $HTTP["url"] =~ "/images" {
  64. #url.access-deny = ("")
  65. url.redirect = (".*" => "http://www.mywebsite.com/")
  66. }
  67. }
  68. proxy.balance = "round-robin"
  69. proxy.server = (
  70. "/" => ((
  71. "host" => "127.0.0.1",
  72. "port" => 8081
  73. ))
  74. )
  75. } else $HTTP["host"] =~ "" {
  76. alias.url = ( "/download/" => "/tmp/download/")
  77. index-file.names = ( "index.html", "index.php" )
  78.  
  79. compress.allowed-encodings = ("gzip", "deflate")
  80. compress.cache-dir = "/tmp/cache/lighttpd/compress/"
  81. compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" )
  82.  
  83. $HTTP["url"] =~ "\.(png)" {
  84. expire.url = ( "" => "access 1 hours")
  85. #expire.url = ( "" => "access 30 days")
  86. #expire.url = ( "" => "access 5 minutes")
  87. #expire.url = ( "" => "access 30 months")
  88. #expire.url = ( "" => "access 1 years")
  89. }
  90. }

nginx(openresty/1.7.2.1)配置如下

  1. #user nobody;
  2. worker_processes 2;
  3.  
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;
  7.  
  8. #pid logs/nginx.pid;
  9. #
  10. events {
  11. worker_connections 1024;
  12. }
  13.  
  14. http {
  15. include mime.types;
  16. default_type application/octet-stream;
  17.  
  18. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  19. '$status $body_bytes_sent "$http_referer" '
  20. '"$http_user_agent" "$http_x_forwarded_for"';
  21.  
  22. access_log logs/access.log main;
  23.  
  24. sendfile on;
  25.  
  26. keepalive_timeout 65;
  27.  
  28. server {
  29. listen 8080;
  30. server_name anotherweb.com www.anotherweb.com;
  31.  
  32. gzip on;
  33. gzip_comp_level 4;
  34. gzip_types text/css text/javascript application/javascript application/octet-stream;
  35.  
  36. #access_log logs/host.access.log main;
  37.  
  38. error_page 500 502 503 504 /50x.html;
  39. location = /50x.html {
  40. root html;
  41. }
  42.  
  43. location / {
  44. root html/ci;
  45. index index.html;
  46. try_files $uri $uri/ /index.php/$query_string;
  47. }
  48.  
  49. location ~ \.php($|/) {
  50. root html/ci;
  51. client_max_body_size 10m;
  52.  
  53. fastcgi_pass 127.0.0.1:9000;
  54. fastcgi_index index.php;
  55. fastcgi_split_path_info ^(.+\.php)(.*)$;
  56. fastcgi_param PATH_INFO $fastcgi_path_info;
  57. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  58. include fastcgi_params;
  59. }
  60. }
  61.  
  62. server {
  63. listen 8080;
  64. server_name www.mywebsite.com image.mywebsite.com mywebsite.com;
  65. default_type text/html;
  66.  
  67. location / {
  68. proxy_pass http://127.0.0.1:8081;
  69. }
  70.  
  71. location /images {
  72. valid_referers none blocked www.mywebsite.com mywebsite.com;
  73. if ($invalid_referer) {
  74. return 403;
  75. }
  76. proxy_pass http://127.0.0.1:8081/images;
  77. }
  78. }
  79. }

lighttpd配置虚拟主机/php等WEB环境的更多相关文章

  1. Tomcat 配置WEB虚拟映射 及 配置虚拟主机

    Tomcat  配置WEB虚拟映射 及 配置虚拟主机 配置WEB虚拟映射文件夹有三种方法例如以下: 第一(要重新启动server的): 打开路径 Tomcat 6.0\conf 下的 server.x ...

  2. linux环境下配置虚拟主机域名

    linux环境下面配置虚拟主机域名 第一步:在root目录下面(即根目录)ls(查看文件)cd进入etc目录find hosts文件vi hosts 打开hosts文件并进行编辑在打开的文件最下面添加 ...

  3. javaweb学习总结十七(web应用组织结构、web.xml作用以及配置虚拟主机搭建网站)

    一:web应用组织结构 1:web应用组成结构 2:安装web组成机构手动创建一个web应用程序目录 a:在webapps下创建目录web b:在web目录下创建html.jsp.css.js.WEB ...

  4. [javaEE] web应用的目录结构&配置虚拟主机

    myWebSite | |-- 静态资源和JSP文件都可以直接放在web应用目录下,浏览器可以直接访问 |-- WEB-INF 浏览器没有办法直接访问 |-- classes 动态web运行时的cla ...

  5. windows环境利用apache 配置虚拟主机

    windows环境利用apache 配置虚拟主机 1.改动http.host #LoadModule vhost_alias_module modules/mod_vhost_alias.so #In ...

  6. 使用WampServer环境,如何配置虚拟主机域名

    很多人不会配置虚拟主机,我这里简单交一下大家,分三步: 1.在 C:\Windows\System32\drivers\etc 文件夹中的文件 Hosts 文件修改代码为: 127.0.0.1 loc ...

  7. PHP 使用WampServer环境,如何配置虚拟主机域名

    很多人不会配置虚拟主机,我这里简单交一下大家,分三步: 1.在 C:\Windows\System32\drivers\etc 文件夹中的文件 Hosts 文件修改代码为: 127.0.0.1 loc ...

  8. Wampserver2.5配置虚拟主机出现403 Forbidden的处理方案

    WampServer是一款由法国人开发的Apache Web服务器.PHP解释器以 及MySQL数据库的整合软件包.免去了开发人员将时间花费在繁琐的配置环境过程,从而腾出更多精力去做开发.在windo ...

  9. Nginx安装及配置虚拟主机

    nginx安装部分 依赖环境 yum -y install gcc zlib openssl-devel zlib-devel 1. 下载好下面两个包:nginx-1.8.1.tar.gz pcre- ...

随机推荐

  1. [solaris]odbc-oracle,简单测试

    #include <string> #include <iostream> #include <stdio.h> #include <sql.h> #i ...

  2. 有关于/home出现100%被占用 与 vnc的关系

    我在远程服务器时,通常使用的程序是vnc.因为vnc可以图形化界面,操作效果比用putty好很多. 但是,我发现使用vnc有一个问题,就是/home占用空间会达到100%. [zy@islab62 ~ ...

  3. Mac OS X 快捷键(完整篇)

    不少朋友提出要求,希望有个「高质量」的列表.其实这样的资源真是太多,平果官网就有 快捷键文档(多国语言版本).于是花了20分钟,浏览了一些网站,整理了点资源放过来供大家参考. 快捷键是通过按下键盘上的 ...

  4. Codeforces 235E

    Codeforces 235E 原题 题目描述:设\(d(n)\)表示\(n\)的因子个数, 给定\(a, b, c\), 求: \[\sum_{i=1}^{a} \sum_{j=1}^{b} \su ...

  5. Struts2 请求参数接收

    在Struts2中提供了更为简单的参数请求与接收方法,可以直接在Action中定义属性:Struts2通过反射机制将参数反射到属性的set方法上实现参数的传递: GET方式传送参数 <strut ...

  6. mvc mvp mvvm区别

    1 mvc是有视图(view),控制器(controller),模型(model)组成 view(用户界面) controller (业务逻辑)            model(数据存储) 接受指令 ...

  7. Bone Collector(01背包+记忆化搜索)

    Bone Collector Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Tota ...

  8. 【Leetcode】Set Matrix Zeroes

    给定一个m x n的矩阵,如果某个元素为0,则把该元素所在行和列全部置0. Given a m x n matrix, if an element is 0, set its entire row a ...

  9. The Tips of Success(成功的建议)

    1.Do one thing at a time,and do well. 2.Never forget to say "thanks". 3,Keep on going.Neve ...

  10. [转载]解析WINDOWS中的DLL文件---经典DLL解读

    [转载]解析WINDOWS中的DLL文件---经典DLL解读 在Windows世界中,有无数块活动的大陆,它们都有一个共同的名字——动态链接库.现在就走进这些神奇的活动大陆,找出它们隐藏已久的秘密吧! ...