9404803 发表于 2018-11-27 11:33:22

做最简单的www—apache php

做最简单的www—apache php
下载
# rpm -qa php*
php-cli-5.1.6-23.2.el5_3
php-devel-5.1.6-23.2.el5_3    ——-php开发包也要
php-common-5.1.6-23.2.el5_3
php-5.1.6-23.2.el5_3    ——-php
php-pdo-5.1.6-23.2.el5_3
php-mysql-5.1.6-23.2.el5_3    —–关联数据库mysql的
php-ldap-5.1.6-23.2.el5_3
# rpm -qa httpd*
httpd-manual-2.2.3-22.el5.centos.1
httpd-2.2.3-22.el5.centos.1       ———–apache
# rpm -qa mysql*
mysql-connector-odbc-3.51.12-2.2
mysql-server-5.0.45-7.el5       ——-mysqlserver
mysql-5.0.45-7.el5                   ———mysql
>>>>>>>>>>>>>
HTTPD –apache

/etc/httpd/conf/httpd.conf   主配置文件
/etc/httpd/conf.d/*.conf额外配置文件,可以在不修改主配置文件的情况下将你额外
的参数独立出来,方便管理,也方便维护
/usr/lib/httpd/modules/* 下面是apache的模块地方,调用就是调用这里的模块
/var/www/html    网页放置的地方
/var/www/error    显示错误的信息提示
/var/www/cgi-bin    CGI的地方
/var/log/httpdapache 的登录日志
/usr/sbin/httpd            启动脚本

/usr/sbin/apachectl         内置的启动命令脚本

/usr/bin/htpasswd用来作最基本的密码保护
>>>>>>>>>>>
php
/usr/lib/httpd/modules/libphp5.so   php模块
/etc/httpd/conf.d/php.conf手动php模块的载入配置文件
/etc/php.iniphp的主配置文件
>>>>>>>>>>>
1.确定主机名,因为是测试 所以用本地
# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

————————————-
2.vi /etc/httpd/conf/httpd.conf
57 ServerRoot “/etc/httpd”最顶层目录
68 Timeout 120接收和发送前超时秒数

74 KeepAlive on是否允许稳定连接—一个tcp连接有多个请求

81 MaxKeepAliveRequests 200 该次传输最大的传输数量
87 KeepAliveTimeout 15在同一个连接上从同一台client接收请求等待的秒数
100
101 StartServers       8
102 MinSpareServers    5
103 MaxSpareServers   20
104 ServerLimit      256
105 MaxClients       256
106 MaxRequestsPerChild4000
107
108
109 # worker MPM
110 # StartServers: initial number of server processes to start
111 # MaxClients: maximum number of simultaneous client connections
112 # MinSpareThreads: minimum number of worker threads which are kept spare
113 # MaxSpareThreads: maximum number of worker threads which are kept spare
114 # ThreadsPerChild: constant number of worker threads in each server process
115 # MaxRequestsPerChild: maximum number of requests a server process serves    —–附赠了解释

116    apache提供2个模块 来设置process数量等,以达到基本优化,2个模式分别适合不同的网络要求, 默认使用prefork.c ,可以在/etc/sysconfig/httpd 下找到
134 Listen 80端口号
148 LoadModule auth_basic_module modules/mod_auth_basic.so
这里打下都是调用的模块. 可以在这里调整你需要的模块

210 Include conf.d/*.conf这里是使用conf.d 目录下文件的设置,apache会把这里的配置文件也一起载入,
231 User apache
232 Group apache   关于apache 执行时候的用户组
265 #ServerName www.example.com:80设定域名 ,
274 UseCanonicalName Off
270 # When set “Off”, Apache will use the Hostname and Port supplied
271 # by the client.When set “On”, Apache will use the value of the
272 # ServerName directive 这里有解释
281 DocumentRoot “/var/www/html”   网页的目录
291         —这个是格式
292   Options FollowSymLinks
293   AllowOverride None
294


391 DirectoryIndex index.html index.html.var index.php默认的主页格式

398 AccessFileName .htaccess   是否允许.htaccess和.htpasswd
399
400 #
401 # The following lines prevent .htaccess and .htpasswd files from being
402 # viewed by Web clients.
403 #
404
405   Order allow,deny
406   Deny from all
407


697 AddLanguage ca .ca 这里打下是apache支持的语系
731 LanguagePriority en zh-CN ca cs da de el eo es et fr he hr it ja ko ltz nl n    n no pl pt pt-BR ru sv zh-TW
语系的优先顺序
747 AddDefaultCharset UTF-8默认使用的字符编码,这里不设定好 ,有时候遇到一些
乱码的事情就是这里,有的支持big5 ,但是现在普遍都是utf-8,或者 你要在网页表头宣告你要加入charset=utf-8 来表示你这个网页是这个编码的
暂时最最基本的配置已经完成了,
———————————————–

3.现在在vi /var/www/html/phpinfo.php

这里有一个测试网页
如果成功是可以看到东西的,如果不行,你要看看防火墙以及selinux有没有关闭,你所使用的端口有没有开启,apache有没有开启,图形界面的iptables开启是system-config-securitylevel





页: [1]
查看完整版本: 做最简单的www—apache php