Linux httpd服务 LAMP

http,tcp,80
stateless 无状态协议

html,
www,89年诞生
 超文本 ascii 不能为二进制文件(MP3..)
 MIME·Multipurpose Internet Mail Extension
tcp
page,object,jpg

 

web服务器网站
 httpd
 lighty
 thttpd
 nginx

中间件:
 IIS1
 Webspere
 Weblogic
 Fusion middleware
 tomcat,resin
 JBoss

getenforce 查看SElinux状态
getenforce 设置SElinux状态
/etc/httpd/
/var/www/

httpd -t 测试服务正确性


  htpasswd -c  第一次使用
  htpasswd -cm /etc/httpd/.htpasswd florian
  htpasswd -m /etc/httpd/.htpasswd gouglas

https

yum install mod_ssl
cd /etc/httpd/
cd conf.d/
vim ssl.conf


WEB:
http,stateless,cookie
http 1.0 1.1
1xx 一般信息
2xx 正常信息
3xx 正确信息,需要补充
4xx 暂时性错误(服务器正常,某个页面出现暂时性错误)
5xx 永久性错误

web:
httpd,fighttpd,nginx

IIS,WEBSPHERE,WEBLOGIC,TOMCAT.RESIN


apache,NCSA,httpd

a patchy server --> apache

ASF

httpd,/etc/init.d/httpd

/etc/httpd,/var/www/html

cgi mod_perl 通用网关系统 不安全

Options execcgi,indexes

DirectoryIndex 定义服务器主页 
 DirectoryIndex    index.html  index.html.var


ACL
 <Directory "/var/www/html">
  options
  AllowOverride None|Authconfig
  AuthName "String"
  AuthType basic
  AuthUserFile "/etc/httpd/.htpasswd"
  Require user valid-user|florian douglas
  order allow,deny
  Allow from all
 </Directory>

.htaccess 单目录认证

htpasswd -cm /etc/httpd/.htpasswd florian 只有第一次用-c选项

 

CGI

虚拟主机:
 通过一个web服务器,同时提供多个网站服务,多个虚拟主机

 主机,占用一个排它性的资源 
  基于ip
  基于port
  基于主机名的虚拟主机

 把重心主机取消或做成一个虚拟主机
 DocumentRoot
 配置虚拟主机

 IP:
 <VirtualHost IP1:port>
   DocumentRoot "/www/a.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/a.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>

 <VirtualHost IP2:port>
   DocumentRoot "/www/b.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/b.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>

 PORT:
 <VirtualHost IP:port1>
   DocumentRoot "/www/a.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/a.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>

 <VirtualHost IP:port2>
   DocumentRoot "/www/b.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/b.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>

 主机名
 NameVirtualHost IP:80
 修改 /etc/hosts 修改地址解析
 <VirtualHost IP:80>
   DocumentRoot "/www/a.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/a.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>

 <VirtualHost IP:80>
   DocumentRoot "/www/b.com"
  ServerName
  ServerAdmin
  Errorlog
  Customlog
  <Directory "/www/b.com">
   Options
   AllowOverride
   Order allow,deny
   Allow from all
  </Directory>
 </VirtualHost>
 修改windows  dns解析

 https不支持基于主机名的虚拟主机,ssl

 tls/ssl


ab:Apache Benchmark apache服务器压力测试

ab -c concurrent -n
 ab -c 100 -n 10000


LAMP

编译环境:

development libraries
development tools
lagacy software development

图形环境:
 KDE
  KDE software development
 Gnome
  gnome softw development

make menuconfig
make gconfig,GTK2
make xconfig,QT

LAMP

apache,mysql,php

rpm:Redhat
rpm:Mysql
 必须位于/usr/local

/etc/profile  对所有用户有效
~/.bash_profile  对当前用户有效

mysql配置:
 mysql/support-flies
 cp mylarge.conf /etc/my.cnf
 cp mysql.server /etc/init.d/mysqld
 chkconfig --add mysqld
 chkconfig --list mysqld
  /etc/rc.d/rc3.d/
 vim /etc/ld.so.conf
 ls /etc/ld.so.conf.d/
 vim /etc/ld.so.conf.d/mysql.conf
  /usr/loca/mysql/lib
 ldconfig [-v | grep mysql] 重新读库关系缓存
 头文件:
  /usr/include 标准位置
  ln-sv /usr/local/mysql/include /usr/include/mysql
  
apache:
 tar jxvf httpd...
 cd httpd..
 ./configure
  --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl -enable-t
 make
 make install
 vim /etc/profile
  PATH-$PATH..
 vim /bin/apachectl
  #chkconfig: 2345 23 76
 写启动脚本
 /etc/init.d/httpd   参照,如果本机卸载,找别的系统的
 suexec

php:
 tar jxvf php-5.3.5.tar.bz2
 ./configure --prefix=/usr/local/php --with-apxs2=/ust/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with=mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring
 
 vim /etc/httpd/httpd.conf
  LoadModule libphp.so
  AddType application/x-httpd-php .php
  DirectoryIndex index.php index.html
 killall httpd
 apachectl start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值