1> 世界上使用率最高的网站服务器,最高时可达70%;官方网站:apache.orgphp
2> http 超文本协议 HTML超文本标记语言css
3> URL 统一资源定位符html
http://www.sina.com.cn:80/admin/index.php前端
http:// -- ssl 安全套接字mysql
www.sina.com.cn -- 域名jquery
:80 -- 端口 http对应80端口,https对应443端口linux
/admin/index.php -- 网址目录和文件名
4> LAMP安装说明nginx
①源码包安装 自定义 开发版本选择方便 效率高c++
生产环境 安全 稳定程序员
· 开发环境 局域网(内网)
②二进制包安装 yum命令安装 官方版本比较低
apache 一共有3种稳定的 MPM 模式(多进程处理模块),它们分别是 prefork、worker、event。http-2.2版本的httpd默认的mpm工做模式为prefork,2.4版本的httpd默认是event工做模式。能够经过 httpd -V 来查看。
[root@localhost ~]# httpd -V | grep -i "server mpm" Server MPM: Prefork
编译的时候,能够经过 configure 的参数来指定:
--with-mpm=prefork|worker|event
Apache在启动之初,就预先fork一些子进程,而后等待请求进来。之因此这样作,是为了减小频繁建立和销毁进程的开销。每一个子进程只有一个线程,在一个时间点内,只能处理一个请求。
做用:用一个进程处理一个用户请求。
优势:成熟稳定,兼容全部新老模块。同时,不须要担忧线程安全的问题。
缺点:一个进程相对占用更多的系统资源,消耗更多的内存。并且,它并不擅长处理高并发请求。
(一个进程生成多个线程,一个线程处理一个客户端请求)
使用了多进程和多线程的混合模式。它也预先fork了几个子进程(数量比较少),而后每一个子进程建立一些线程,同时包括一个监听线程。每一个请求过来,会被分配到1个线程来服务。线程比起进程会更轻量,由于线程一般会共享父进程的内存空间,所以,内存的占用会减小一些。在高并发的场景下,由于比起prefork有更多的可用线程,表现会更优秀一些
做用:一个进程生成多个线程,一个线程处理一个用户请求
优势:占据更少的内存,高并发下表现更优秀。
缺点:必须考虑线程安全的问题。
(支持keepalive,数据传送完毕自动断开,可是不支持https)
用一个线程处理一个用户请求。它和worker模式很像,最大的区别在于,它解决了keep-alive场景下,长期被占用的线程的资源浪费问题。event MPM中,会有一个专门的线程来管理这些keep-alive类型的线程,当有真实请求过来的时候,
将请求传递给服务线程,执行完毕后,又容许它释放。这样加强了高并发场景下的请求处理能力。
HTTP采用keepalive方式减小TCP链接数量,可是因为须要与服务器线程或进程进行绑定,致使一个繁忙的服务器会消耗完全部的线程。Event MPM是解决这个问题的一种新模型,它把服务进程从链接中分离出来。在服务器处理速度很快,同时具备很是高的点击率时,可用的线程数量就是关键的资源限 制,此时Event MPM方式是最有效的,但不能在HTTPS访问下工做。
apache为企业中经常使用的web服务,用来提供http://(超文本传输协议)
主配置目录:/etc/httpd/conf
主配置文件:/etc/httpd/conf/http.conf
子配置目录:/etc/httpd/conf.d
子配置文件:/etc/httpd/conf.d/*.conf
默认发布目录:/var/www/html/
默认发布文件:index.html
默认端口:80
表示请求的是否成功等信息。
1xx:通常不用,就是一些描述信息
2xx:表示请求成功
200:ok,请求下载成功
201:create ok,上传成功
3xx:表示请求的资源被重定向
301:moved permanently,永久重定向
302:Found,临时重定向
304:not modified,标识一个缓存的资源是否发生过更改
4xx:请求失败,由于客户端缘由致使失败
403:forbidden,表示客户端没有权限访问所请求的资源
404:Not Found,表示客户端所请求的资源不存在
405:Method Not allowd:表示客户端所用的方法不被容许
5xx:请求失败,由于服务器端缘由致使失败
500:Internal Server Error,服务器内部错误
502:Bad Gateway,代理服务器从上游服务器获取到的是伪响应
503:service unavailable,服务器暂时不可用
LAMP=Linux Apache Mysql/MariaDB PHP/Perl/Python 这些软件都是开源免费的软件,几个程序各自是独立的,常常为了达到咱们须要的效果而协同工做,组成了咱们常见的LAMP架构平台! LAMP是世界上最流行的组合,固然同时也有Nginx(linux+nginx+mysql/mariadb+php),也就是LNMP: LAMP 相对于 NGINX 来讲较为安全,可是Nginx处理高并发比apache要强,NGINX 相对于 LAMP 来讲安全较为差一点,一样的配制环境负载远远高于 LAMP 向国内的一些大公司,淘宝、新浪都在用这一些 NGINX,像那么大的公司网站须要用到服务器群用LAMP搭建环境成本远远大于NGINX。打个比方原本1000000W访问量须要 10台LAMP环境服务器才能完成,可是使用NGINX也许只须要五、6台这样一来对于这样的公司来讲就大大的节约了成本。
从网站的流量上来讲,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案,在之前这句话没有错,可是在如今,这句话有待证明!!!由于在之后的过程当中,会发现咱们会使用的架构是Nginx和apache结合使用:使用Nginx能够作集群等相关配置,能够和apache一块儿使用,有的会用apache去跑php,而后用nginx作反向代理,好比apache运行在8080端口,nginx在80端口,访问php文件时,反向代理到apache,静态页经过nginx处理。nginx支持高并发,apache对php的运行比较稳定。
常见的网页类型:htm,html,shtml,stm.php,asp,aspx,shtm,jsp等等apache本事只处理静态页面,处理动态页面须要使用libphp5.so这个模块去工做,编译php也实际上是将一个相当重要的模块打入到apache内部,而后apache收到php请求,将请求交给这个模块来处理!
LAMP的架构:
LAMP是一个多C/S架构的平台,最初级为web客户端基于TCP/IP经过http协议发起传送,这个请求多是动态的,也多是静态的。
因此web服务器经过发起请求的后缀来判断,若是是静态的资源就由web服务器自行处理,而后将资源发给客户端。若是是动态这时web服务器会经过CGI(Common Gateway Interface)协议发起给php。
这里可是若是php是以模块形式与Web服务器联系。那么他们是经过内部共享内存的方式。若是是php单独的放置与一台服务器,那么他们是经过sockets套接字监听的方式通讯(这又是一个C/S架构)。
这时php会相应的执行一段程序,若是在执行程序时,须要用到数据。那么php就会经过mysql协议发送给mysql服务器(也能够看做是一个C/S架构)。由mysql服务器处理,将数据供给php程序。
1)用户发送http请求到达httpd服务器;
2)httpd解析url获取须要的资源的路径,经过内核空间读取硬盘资源,如是静态资源,则构建响应报文,发回给用户;
3)若是是动态资源,将资源地址发给php解析器,解析php程序文件,解析完毕将内容发回给httpd,httpd构建响应报文,发回给用户;
4)若是涉及到数据库操做,则利用php-mysql驱动,获取数据库数据,返回给PHP解析器。
(客户端访问网站,若是是静态请求与,apache直接返回数据;
若是是动态请求,apache会经过cgi协议联系php模块,而后返回客户端请求;
若是php须要调用数据库就会经过php-mysql联系数据库,拿到数据以后,再返回给apache,再返回给客户端。)
第一种:把php编译时直接编译成apache的模块、module模块化的方式进行工做(apahce默认的这种方式)。
第二种:CGI,通用网关接口,apache基于CGI跟hph通讯。
第三种:fastcgi是一种协议,在这种模块下他们两个是这样结合的:
原本php是作为一个模块或都是php解析器运行的,不是监听在某个套接字上接收别人的请求的,而是让别人调用为一个进程使用的,多是作为别人的子进程在运行,可是工做在fastcgi这种模块下的hph自行启用为一个服务进程,
它监听在某个套接字上,随时能够接受来自客户端的请求的,它也是有一个主进程的,为了能够响应多个用户的请求,它会启用多个子进程,这些子进程咱们也能够称为工做进程,
它也是有空闲进程的,一但有客户请求它立刻使用空闲的进程响应客户端的请求,将结果返回给前端的调用者,在php5.3.3版本以前他是没有这个能力了,只能工做在模块和CGI的方式下,而在5.3.3以后这个模块直接被收进php模块中,这种模块就叫php-fpm。
因此在之后编译php时,要想跟apache结合,就要编译成php-fpm,这是基于fastcgi工做的模式,并启动这服务进程,也就意味着他是经过套接字跟前端的调用者通讯
=.,既然基于套按字通讯了,那么前端的web服务器和后面的php服务器彻底能够工做在不一样的主机上,实现了所谓的分层机制。
apache不会跟数据库打交道,他是个静态web服务器,跟数据库打交道的是应用程序,做为应用程序的源驱动可以基于某个aPi跟服务器之间创建会话,然后他会经过咱们的mysql语句发送给数据库,数据库再将结果返回给应用程序,不是php进程,而是php进程中所执行的代码。
PHP与mysql整合,httpd调用php
首先httpd并不具有解析代码的能力,要依赖于php的解析器,php自己不依赖于mysql,他只是一个解析器,能执行代码就OK了,那他何时用到mysql呢,若是要在mysql中存数据时才用到mysql,只是当php中有运行mysql语句时才用到mysql。
php语言要想联系mysql,一般用到php的驱动,rpm包的叫php_mysql,php跟mysql没有一点关系,只有程序员在php中编写mysql语句时才链接mysql来执行sql语句的。
基于php-mysql去链接mysql只使用一个函数mysql_connect();而mysql_connect()正是php-mysql提供的一个aPi,只要指明要链接的服务器便可。
apache=http://httpd.apache.org/ httpd主程序包
MySQl=http://dev.mysql.com/downloads/mysql/ mysql主程序包
PHP=http://php.net/downloads.php php主程序包
apr=http://apr.apache.org/ apr是httpd的依赖包
apr-util=http://apr.apache.org/ apr-util是httpd的第二个依赖包
apr和apr-util这个两个软件是对后端服务软件进行优化的,
apr-util只是在apr的基础上提供了更多的数据结构和操做系统封装接口而已。
pcre 是httpd的第三个依赖包 http://pcre.org/
PCRE(Perl Compatible Regular Expressions中文含义:perl语言兼容正则表达式)是一个用C语言编写的正则表达式函数库,PCRE被普遍使用在许多开源软件之中,最著名的莫过于apache HTTP服务器和PHP脚本语言、R脚本语言,此外,正如从其名字所能看到的,PCRE也是perl语言的缺省正则库。
三个缘由:版本、安装路径、新功能特性
1> 知足不一样的运行平台:咱们linux发型版本众多,可是每一个版本采用的软件或者内核版本都不同,而咱们的二进制包所依赖的环境不必定可以正常运行,因此大部分软件直接提供源码!
2> 方便定制,知足不一样的需求:不少时候咱们所须要的软件都是能够定制的,我须要什么就安装什么,大多数二进制代码都是一键装全,因此自由度并不高!
3> 方便运维、开发人员维护:咱们的源码是能够打包二进制的,可是对于这个软件的打包都会有一份代价不小的额外工做,包括维护,因此若是是源码的话,软件产商会直接维护,可是若是是二进制的话,通常都是linux发行商提供!
[root@localhost ~]# yum install gcc gcc-c++ ncurses-devel ncurses pcre pcre-devel openssl-devel zlib-devel -y #安装依赖包 [root@localhost ~]# yum install lrzsz -y #安装rz依赖包 [root@localhost ~]# rz #上传安装包
[root@localhost ~]# ls anaconda-ks.cfg apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz httpd-2.4.20.tar.gz [root@localhost ~]# tar xf apr-1.5.2.tar.gz #解压 [root@localhost ~]# tar xf apr-util-1.5.4.tar.gz [root@localhost ~]# tar xf httpd-2.4.20.tar.gz [root@localhost ~]# cd apr-1.5.2 #进入cd apr-1.5.2 [root@localhost apr-1.5.2]# ls apr-config.in build configure.in libapr.dep memory random threadproc apr.dep buildconf docs libapr.dsp misc REaDME time apr.dsp build.conf dso libapr.mak mmap REaDME.cmake tools apr.dsw build-outputs.mk emacs-mode libapr.rc network_io shmem user apr.mak CHaNGES encoding liCENSE NOTiCE strings apr.pc.in CMakelists.txt file_io locks NWGNUmakefile support apr.spec config.layout helpers Makefile.in passwd tables atomic configure include Makefile.win poll test [root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr && make && make install #检查编译环境 指定安装路径 编译 编译安装 /usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk /usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config # apr-1.5.2安装完成 [root@localhost ~]# cd apr-util-1.5.4 #编译安装apr-util-1.5.4(组件) [root@localhost apr-util-1.5.4]# ./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util && make && make install /usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib /usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config # apr-util-1.5.4安装完成 [root@localhost ~]# cd httpd-2.4.20 #编译配置apache [root@localhost httpd-2.4.20]# ./configure --help |more #按需配置apache [root@localhost httpd-2.4.20]# ./configure --prefix=/usr/local/http2.4 \ #开始安装apache,\表示续行,即一条命令没写完,再起一行写 > --with-apr=/usr/local/apr \ #功能: #apr > --with-apr-util=/usr/local/apr-util \ #apr-util > --enable-cache \ #缓存 > --enable-deflate \ #压缩传输 > --enable-proxy \ #代理 > --enable-ssl \ #加密协议 > --enable-static-ab \ #压力测试 > --enable-cgi \ #CGi协议 > --enable-userdir \ #开启用户家目录 > --enable-rewrite \ #重定向 #回车后安装, [root@localhost httpd-2.4.20]make && make install #开始编译安装 mkdir /usr/local/http2.4/manual make[1]: leaving directory `/root/httpd-2.4.20' #安装完成 [root@localhost httpd-2.4.20]# cd /usr [root@localhost usr]# ls bin etc games include lib lib64 libexec local sbin share src tmp [root@localhost usr]# cd local [root@localhost local]# ls apr bin games include lib64 sbin src apr-util etc http2.4 lib libexec share [root@localhost local]# cd http2.4 [root@localhost http2.4]# ls bin cgi-bin error icons logs manual build conf htdocs include man modules [root@localhost http2.4]# cd bin [root@localhost bin]# ls ab checkgid envvars-std htdbm httpd rotatelogs apachectl dbmmanage fcgistarter htdigest httxt2dbm apxs envvars htcacheclean htpasswd logresolve [root@localhost bin]# ./apachectl start #切换到 /usr/local/http2.4/bin下启动,./表示在当前目录下 aH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message #警告 [root@localhost bin]# ss -tnl liST 0 128 :::80 :::* #检查发现80端口成功启动 #根据警告信息记入配置文件/etc/httpd2.4/conf/httpd.conf将ServerName www.example.com:80 前的备注删掉 [root@localhost httpd-2.4.20]# cd /usr/local/httpd2.4/bin [root@localhost bin]# ./apachectl restart #再次启动,成功启动且无警告 [root@localhost bin]# ss -tnl liSTEN 0 128 :::80 :::*
[root@localhost httpd-2.4.20]# vim /etc/httpd/conf/httpd.conf
ServerRoot "/etc/httpd" #服务根目录
#listen 12.34.56.78:80
Listen 80 #端口
include conf.modules.d/*.conf #加载的模块信息
User apache #apach用户
Group apache #apach用户组
Serveradmin root@localhost #管理员邮箱
#ServerName www.example.com:80 #域名
<Directory /> #网站根目录/表示/var/www/html
allowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html" #网站根目录
<ifModule dir_module>
DirectoryIndex index.html #默认首页文件
</ifModule>
Errorlog "logs/error_log" #日志信息
includeOptional conf.d/*.conf #子配置文件
[root@localhost ~]# ls /var/log/messages #系统错入日志都放在此目录下 [root@localhost ~]# ls /var/log/httpd/ #apache的日志都放在/var/log/httpd/下 access_log error_log
[root@localhost ~]# ps aux | grep apache apache 32072 0.0 0.2 221920 2952 ? S apr19 0:00 /usr/sbin/httpd -DFOREGROUND apache 32073 0.0 0.2 221920 2952 ? S apr19 0:00 /usr/sbin/httpd -DFOREGROUND apache 32074 0.0 0.2 221920 2952 ? S apr19 0:00 /usr/sbin/httpd -DFOREGROUND apache 32075 0.0 0.2 221920 2952 ? S apr19 0:00 /usr/sbin/httpd -DFOREGROUND apache 32076 0.0 0.2 221920 2952 ? S apr19 0:00 /usr/sbin/httpd -DFOREGROUND root 32097 0.0 0.0 112648 956 pts/1 R+ 00:26 0:00 grep --color=autoapache
apache编译完成后,在windows浏览器输入服务机地址打开后会出现test界面,须要注释掉/etc/httpd/conf.d/welcome.conf文件
[root@localhost ~]# vim /etc/httpd/conf.d/welcome.conf # # This configuration file enables the default "Welcome" page if there # is no default index page present for the root URl. To disable the # Welcome page, comment out all the lines below. # # NOTE: if this file is removed, it will be restored on upgrades. # <locationMatch "^/+$"> Options -indexes ErrorDocument 403 /.noindex.html </locationMatch> <Directory /usr/share/httpd/noindex> allowOverride None Require all granted </Directory> alias /.noindex.html /usr/share/httpd/noindex/index.html alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
一次性注释步骤:
鼠标滑至需注释文件的开头
ctrl+v 进入visual block界面
鼠标滑至文件末尾
shift+i
#
esc
结果:
# # This configuration file enables the default "Welcome" page if there # is no default index page present for the root URl. To disable the # Welcome page, comment out all the lines below. # # NOTE: if this file is removed, it will be restored on upgrades. # #<locationMatch "^/+$"> # Options -indexes # ErrorDocument 403 /.noindex.html #</locationMatch> # #<Directory /usr/share/httpd/noindex> # allowOverride None # Require all granted #</Directory> # #alias /.noindex.html /usr/share/httpd/noindex/index.html #alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css #alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css #alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif #alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
用来对网站的访问状况进行统计
ip:internet protocol,独立IP数,表示咱们的网站在一天以内被多少IP访问过(00-24),相同IP一天只能计为一次,这种统计方式是不许确的,实际的访问人数的多于IP数的。
pv:Page View,表示是的在一天以内某个页面被访问过多少次(每刷新一次,算一次访问)。
uv:uniq vistor,独立访客,表示一个用户就是一个uv
计算ip pv方式
1> 在页面中插入一段js代码,实现统计
2> 分析日志
3> 使用第三方平台作统计
计算uv方式
1> 给每一个客户端分配cookie,对cookie处理来实现统计
2> 根据客户端的特征信息(ip+浏览器类型+机器其余信息)
网站 iP(万) PV(万) 服务器数量(台)
58 250 3000 500
51cto.com 40 80-100 30
chinaunix 28 50-80 15
taobao 7-8000 5000-10000 10000
利用虚拟主机功能,能够把一台处于运行状态的物理服务器分割成多个“虚拟的服务器”。
apache的虚拟主机功能是服务器基于用户请求的不一样主机域名或端口号,实现提供多个网站同时为外部提供访问服务的技术,用户请求的资源不一样,最终获取到的网页内容也各不相同。
该方案适合访问量少的公司实施。
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf #进入配置文件 # logged here. if you *do* define an error logfile for a <VirtualHost> #复制VirtualHost <VirtualHost *:81> DocumentRoot /var/www/zxj1 #网站根目录 Diredtoryindex index.htlm #首页文件 </VirtualHost> <VirtualHost *:82> DocumentRoot /var/www/zx21 Diredtoryindex index.htlm </VirtualHost> #listen 12.34.56.78:80 listen 80 listen 81 #端口监听 listen 82 #端口监听 :wq [root@localhost ~]# mkdir /var/www/zxj{1,2} #建立目录 [root@localhost ~]# echo "1" > /var/www/zxj1/index.html #写入文件 [root@localhost ~]# echo "2" > /var/www/zxj2/index.html [root@localhost ~]# systemctl restart httpd #重启apache [root@localhost ~]# ss -tnl #查看端口 LISTEN 0 128 :::80 :::* LISTEN 0 128 :::81 :::* LISTEN 0 128 :::82 :::*
在windows浏览器查看
虚拟主机建立成功
再加上域名
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf VirtualHost *:81> ServerName www.zxj1.com DocumentRoot /var/www/zxj1 Directoryindex index.html </VirtualHost> <VirtualHost *:82> ServerName www.zxj2.com DocumentRoot /var/www/zxj2 Directoryindex index.htlm </VirtualHost> :wq [root@localhost ~]# systemctl restart httpd #重启apache [root@localhost ~]# curl 192.168.16.7:81 #查看虚拟主机 1 [root@localhost ~]# curl 192.168.16.7:82 2 [root@localhost ~]# curl www.zxj1.com:82 curl: (7) Failed connect to www.zxj1.com:82; Connection refused
但访问域名访问不到。
解决办法:
写入host和windows的host文件
[root@localhost ~]# vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.16.7 www,zxj1.com www.zxj2.com #写入host
192.168.16.7 www.zxj1.com
192.168.16.7 www.zxj2.com
[root@localhost ~]# rz #上传压缩包

[root@localhost ~]#yum install unzip -y #下载解压文件 [root@localhost ~]# ls anaconda-ks.cfg jd.zip wordpress wordpress-3.3.1-zh_CN.zip [root@localhost ~]#unzip jd.zzp #解压 [root@localhost ~]# ls jd/jd [root@localhost ~]# ls jd/jd css gw01.jpg jd.jpg logo-201305.png regist.html vip.jpg cx.jpg gwc.jpg js order.html search.jpg zf03.jpg cy.jpg img jy.jpg phone.jpg sh04.jpg ═ъ╒√╨з╣√═╝.jpg dakehu.jpg index kx.jpg php star.jpg favicon2.ico index.html login.html ps02.jpg ts05.jpg #首页文件默认为index.html。win端输入时可默认 [root@localhost ~]# systemctl restart httpd
win浏览器输入地址查看
部署(上线成功)
[root@localhost ~]# rz #上传压缩包 [root@localhost ~]# ls anaconda-ks.cfg game.zip jd jd.zip wordpress wordpress-3.3.1-zh_CN.zip [root@localhost ~]# unzip game.zip [root@localhost ~]# ls game images jquery-1.8.3.min.js readme.xls sky_fight.html sky.php
win端访问的html文件
上线成功!
[root@localhost ~]# rz #上传压缩包 [root@localhost ~]#unzip wordpress-3.3.1-zh_CN.zip #解压 [root@localhost ~]# ls anaconda-ks.cfg game.zip jd jd.zip wordpress wordpress-3.3.1-zh_CN.zip [root@localhost ~]# cd wordpress [root@localhost wordpress]# ls index.php wp-blog-header.php wp-links-opml.php wp-settings.php license.txt wp-comments-post.php wp-load.php wp-signup.php readme.html wp-config-sample.php wp-login.php wp-trackback.php wp-activate.php wp-content wp-mail.php xmlrpc.php wp-admin wp-cron.php wp-pass.php wp-app.php wp-includes wp-register.php [root@localhost wordpress]# cp wp-config-sample.php wp-config.php #备份文件 [root@localhost wordpress]# vim wp-config.php #编辑配置文件 /** WordPress 数据库的名称 */ define('DB_NaME', 'zxj'); /** MySQl 数据库用户名 */ define('DB_USER', 'zxj'); /** MySQl 数据库密码 */ define('DB_PaSSWORD', '123'); :wq [root@localhost wordpress]# yum install httpd mariadb-server php php-mysql -y #安装完整的LAMP架构 #数据库配置: [root@localhost wordpress]# systemctl restart mariadb #1启动数据库 [root@localhost wordpress]# mysql -u root -p #2进入数据库 Enter password: #此处回车 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zxj; #3建立数据库,以;结尾 MariaDB [(none)]> grant all on *.* to zxj@'localhost' identified by '123' #4 受权用户 受权 全部权限 在全部库的全部表 给zxj用户 在localhost主机登陆 密码123认证 MariaDB [(none)]> exit #退出 Bye [root@localhost wordpress]# vim /etc/httpd/conf/httpd.conf 3 #进入主配置文件 # is requested. # <ifModule dir_module> Directoryindex index.php index.html #添加index.php 文件 </ifModule> ;wq [root@localhost wordpress]# systemctl restart mariadb #重启数据库 [root@localhost wordpress]# systemctl restart httpd #重启apach
windows端浏览器访问,进入动态网站界面。
登陆成功。