VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云最新优惠促销活动
jtti最新优惠促销活动

apache

locvps
主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

############apache的安装###############vim /etc/yum.repos.d/rhel_dvd.repoyum install -y httpdsystemctl start httpdsystemctl stop firewalldsystemctl enable httpdsystemctl disable firewalld#############apache的信息###################1.Apache主配置文件: /etc/httpd/conf/httpd.conf2.监听端口:803.apache的默认发布文件index.html4.apache的默认发布目录/var/www/html#############apache的基本设置####################[root@localhost ~]# cd /var/www/html[root@localhost html]# ls[root@localhost html]# vim /var/www/html/westos.html   1 <h2gt;westos's page</h2gt;[root@localhost html]# vim /etc/httpd/conf/httpd.conf 166 <IfModule dir_modulegt; 167     DirectoryIndex westos.html index.html 168 </IfModulegt;[root@localhost html]# cd[root@localhost ~]# mkdir /westos/www/html[root@localhost ~]# mkdir /westos/www/test -p   1 /westos/www/test/westos.html's page[root@localhost ~]# vim /etc/httpd/conf/httpd.conf          119 #DocumentRoot "/var/www/html"120 DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;[root@localhost ~]# getenforceEnforcing[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive[root@localhost ~]# systemctl restart httpd测试############apache用户访问设置##########[root@localhost html]# mkdir admin[root@localhost admin]# vim admin 1 <h2gt;admin's page</h2gt;[root@localhost html]# lsadmin  index.html  westos.html[root@localhost html]# cd admin/[root@localhost admin]# ls[root@localhost admin]# vim admin[root@localhost admin]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt;     #####只允许75主机进行访问125       Order Deny,Allow126       Allow from 172.25.254.75127       Deny from All128 </Directorygt;171 <IfModule dir_modulegt;172     DirectoryIndex admin westos.html index.html173 </IfModulegt;[root@localhost admin]# systemctl restart httpd测试

[root@localhost admin]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt;             ####允许其他用户访问,但不允许75主机访问125       Order Allow,Deny126       Allow from All127       Deny from 172.25.254.75128 </Directorygt;[root@localhost admin]# systemctl restart httpd
测试[root@localhost admin]# cd /etc/httpd[root@localhost httpd]# lsconf  conf.d  conf.modules.d  logs  modules  run[root@localhost httpd]# htpasswd -cm /etc/httpd/accessuser adminNew password: Re-type new password: Adding password for user admin[root@localhost httpd]# cat /etc/httpd/accessuseradmin:$apr1$hLx1MnNl$J9vtdAFtpX2BjL6eMD22x.[root@localhost httpd]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"    #####允许有密码的用户访问120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt; 125      AuthUserFile /etc/httpd/accessuser  ###用户认证文件126      AuthName "please input your name and password !!"        ###用户认证提示信息127      AuthType basic               ###认证类型128      Require valid-user           ###认证用户,认证文件中所用的用户可以通过129 </Directorygt;[root@localhost httpd]# systemctl restart httpd

测试###############CGI#####################[root@localhost html]# yum install -y php[root@localhost html]# systemctl restart httpd[root@localhost html]# vim index.php   1 <?php   2         phpinfo();   3 ?gt;[root@localhost html]# cd /etc/httpd/conf.d[root@localhost conf.d]# lsautoindex.conf  php.conf  README  userdir.conf  welcome.conf[root@localhost conf.d]# mkdir /var/www/html/cgi[root@localhost conf.d]# cd /var/www/html/cgi[root@localhost cgi]# ls[root@localhost cgi]# vim index.cgi   1 #!/usr/bin/perl   2 print "Content-type: text/htmlnn";   3 print `date`;[root@localhost cgi]# perl index.cgiContent-type: text/html2017年  5月 16日 火曜日 07:24:23 EDT[root@localhost cg i]# chmod +x index.cgi[root@localhost cgi]# vim /etc/httpd/conf/httpd.conf 130 <Directory "/var/www/html/cgi"gt;131        Options +ExecCGI132        AddHandler cgi-script .cgi133 </Directorygt;176 <IfModule dir_modulegt;177     DirectoryIndex index.cgi admin westos.html index.html178 </IfModulegt;[root@localhost cgi]# systemctl restart httpd测试############apache虚拟主机##############1.定义可以让我们的一台apache服务器访问不同域名时显示不同的网页2.建立测试页mkdir virtual/news.westos.com -pmkdir virtual/money.westos.com -pmkdir virtual/news.westos.com/html -pmkdir virtual/money.westos.com/html -pecho "new.westos.com's page" gt;virtual/news.westos.com/html/index.htmlecho "money.westos.com's page" gt;virtual/money.westos.com/html/index.html3.配置vim /etc/httpd/conf.d/default.conf      ##指定域名的访问都访问default  1 <Virtualhost     _default_:80gt;      ##虚拟主机开启的端口  2           DocumentRoot "/var/www/html" ##虚拟主机的默认发布目录  3           CustomLog "logs/default.log" combined  ##虚拟主机的日志  4 </Virtualhostgt;vim /etc/httpd/conf.d/news.conf       ##指定域名news.westos.com访问到默认发布目录  1 <Virtualhost *:80gt;  2          ServerName "news.westos.com"  3          DocumentRoot "/var/www/virtual/news.westos.com/html"  4          CustomLog "logs/news.log" combined  5 </Virtualhostgt;  6 <Directory "/var/www/virtual/news.westos.com/html"gt;    ##默认发布目录的访问授权  7           Require all granted  8 </Directorygt;vim /etc/httpd/conf.d/money.conf     ####指定域名money.westos.com访问到默认发布目录  1 <Virtualhost *:80gt;  2          ServerName "money.westos.com"  3          DocumentRoot "/var/www/virtual/money.westos.com/html"  4          CustomLog "logs/news.log" combined  5 </Virtualhostgt;  6 <Directory "/var/www/virtual/money.westos.com/html"gt; ####默认发布目录的访问授权  7           Require all granted  8 </Directorygt;3.在客户主机中添加解析vim /etc/hosts 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6172.25.254.250  content.exle.com172.25.254.195 www.westos.com news.westos.com money.westos.com~                     测试

###############https###############yum install -y mod_sslyum install -y crypto-utilssystemctl stop firewalldgenkey www.westos.com


############apache的安装###############vim /etc/yum.repos.d/rhel_dvd.repoyum install -y httpdsystemctl start httpdsystemctl stop firewalldsystemctl enable httpdsystemctl disable firewalld#############apache的信息###################1.Apache主配置文件: /etc/httpd/conf/httpd.conf2.监听端口:803.apache的默认发布文件index.html4.apache的默认发布目录/var/www/html#############apache的基本设置####################[root@localhost ~]# cd /var/www/html[root@localhost html]# ls[root@localhost html]# vim /var/www/html/westos.html   1 <h2gt;westos's page</h2gt;[root@localhost html]# vim /etc/httpd/conf/httpd.conf 166 <IfModule dir_modulegt; 167     DirectoryIndex westos.html index.html 168 </IfModulegt;[root@localhost html]# cd[root@localhost ~]# mkdir /westos/www/html[root@localhost ~]# mkdir /westos/www/test -p   1 /westos/www/test/westos.html's page[root@localhost ~]# vim /etc/httpd/conf/httpd.conf          119 #DocumentRoot "/var/www/html"120 DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;[root@localhost ~]# getenforceEnforcing[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive[root@localhost ~]# systemctl restart httpd测试############apache用户访问设置##########[root@localhost html]# mkdir admin[root@localhost admin]# vim admin 1 <h2gt;admin's page</h2gt;[root@localhost html]# lsadmin  index.html  westos.html[root@localhost html]# cd admin/[root@localhost admin]# ls[root@localhost admin]# vim admin[root@localhost admin]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt;     #####只允许75主机进行访问125       Order Deny,Allow126       Allow from 172.25.254.75127       Deny from All128 </Directorygt;171 <IfModule dir_modulegt;172     DirectoryIndex admin westos.html index.html173 </IfModulegt;[root@localhost admin]# systemctl restart httpd测试

[root@localhost admin]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt;             ####允许其他用户访问,但不允许75主机访问125       Order Allow,Deny126       Allow from All127       Deny from 172.25.254.75128 </Directorygt;[root@localhost admin]# systemctl restart httpd
测试[root@localhost admin]# cd /etc/httpd[root@localhost httpd]# lsconf  conf.d  conf.modules.d  logs  modules  run[root@localhost httpd]# htpasswd -cm /etc/httpd/accessuser adminNew password: Re-type new password: Adding password for user admin[root@localhost httpd]# cat /etc/httpd/accessuseradmin:$apr1$hLx1MnNl$J9vtdAFtpX2BjL6eMD22x.[root@localhost httpd]# vim /etc/httpd/conf/httpd.conf119 DocumentRoot "/var/www/html"    #####允许有密码的用户访问120 #DocumentRoot "/westos/www/test"121 <Directory "/westos/www/test"gt;122       Require all granted123 </Directorygt;124 <Directory "/var/www/html/admin"gt; 125      AuthUserFile /etc/httpd/accessuser  ###用户认证文件126      AuthName "please input your name and password !!"        ###用户认证提示信息127      AuthType basic               ###认证类型128      Require valid-user           ###认证用户,认证文件中所用的用户可以通过129 </Directorygt;[root@localhost httpd]# systemctl restart httpd

测试###############CGI#####################[root@localhost html]# yum install -y php[root@localhost html]# systemctl restart httpd[root@localhost html]# vim index.php   1 <?php   2         phpinfo();   3 ?gt;[root@localhost html]# cd /etc/httpd/conf.d[root@localhost conf.d]# lsautoindex.conf  php.conf  README  userdir.conf  welcome.conf[root@localhost conf.d]# mkdir /var/www/html/cgi[root@localhost conf.d]# cd /var/www/html/cgi[root@localhost cgi]# ls[root@localhost cgi]# vim index.cgi   1 #!/usr/bin/perl   2 print "Content-type: text/htmlnn";   3 print `date`;[root@localhost cgi]# perl index.cgiContent-type: text/html2017年  5月 16日 火曜日 07:24:23 EDT[root@localhost cg i]# chmod +x index.cgi[root@localhost cgi]# vim /etc/httpd/conf/httpd.conf 130 <Directory "/var/www/html/cgi"gt;131        Options +ExecCGI132        AddHandler cgi-script .cgi133 </Directorygt;176 <IfModule dir_modulegt;177     DirectoryIndex index.cgi admin westos.html index.html178 </IfModulegt;[root@localhost cgi]# systemctl restart httpd测试############apache虚拟主机##############1.定义可以让我们的一台apache服务器访问不同域名时显示不同的网页2.建立测试页mkdir virtual/news.westos.com -pmkdir virtual/money.westos.com -pmkdir virtual/news.westos.com/html -pmkdir virtual/money.westos.com/html -pecho "new.westos.com's page" gt;virtual/news.westos.com/html/index.htmlecho "money.westos.com's page" gt;virtual/money.westos.com/html/index.html3.配置vim /etc/httpd/conf.d/default.conf      ##指定域名的访问都访问default  1 <Virtualhost     _default_:80gt;      ##虚拟主机开启的端口  2           DocumentRoot "/var/www/html" ##虚拟主机的默认发布目录  3           CustomLog "logs/default.log" combined  ##虚拟主机的日志  4 </Virtualhostgt;vim /etc/httpd/conf.d/news.conf       ##指定域名news.westos.com访问到默认发布目录  1 <Virtualhost *:80gt;  2          ServerName "news.westos.com"  3          DocumentRoot "/var/www/virtual/news.westos.com/html"  4          CustomLog "logs/news.log" combined  5 </Virtualhostgt;  6 <Directory "/var/www/virtual/news.westos.com/html"gt;    ##默认发布目录的访问授权  7           Require all granted  8 </Directorygt;vim /etc/httpd/conf.d/money.conf     ####指定域名money.westos.com访问到默认发布目录  1 <Virtualhost *:80gt;  2          ServerName "money.westos.com"  3          DocumentRoot "/var/www/virtual/money.westos.com/html"  4          CustomLog "logs/news.log" combined  5 </Virtualhostgt;  6 <Directory "/var/www/virtual/money.westos.com/html"gt; ####默认发布目录的访问授权  7           Require all granted  8 </Directorygt;3.在客户主机中添加解析vim /etc/hosts 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6172.25.254.250  content.exle.com172.25.254.195 www.westos.com news.westos.com money.westos.com~                     测试

###############https###############yum install -y mod_sslyum install -y crypto-utilssystemctl stop firewalldgenkey www.westos.com

--------------------------------------------------------------
主机参考,收集国内外VPSVPS测评主机测评云服务器虚拟主机独立服务器,国内外服务器高性价比建站主机相关优惠信息@zhujicankao.com
详细介绍和测评国外VPS主机,云服务器,国外服务器,国外主机的相关优惠信息,商家背景,网络带宽等等,也是目前国内最好的主机云服务器VPS参考测评资讯优惠信息分享平台

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:apache https://zhujicankao.com/12684.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » apache
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

相关推荐

评论 抢沙发

评论前必须登录!