首页 > 其他分享 >LAMP实验

LAMP实验

时间:2023-12-21 11:34:29浏览次数:27  
标签:httpd Deny phpMyAdmin Require LAMP 实验 Allow Apache

LAMP

确保CentOS系统已经安装了Apache、MySQL和PHP。可以使用以下命令检查它们是否已安装:

sudo yum list installed httpd mariadb-server php php-mysqlnd

如果它们没有安装,可以使用以下命令安装它们:

sudo yum install httpd mariadb-server php php-mysqlnd -y

Apache

httpd -t:语法检查

httpd -v:查看版本

httpd -m :查看模块

全局配置:

ServerName:对应域名

DocumentRoot:对应网站根目录

DirectoryIndex:网站默认首页

虚拟主机

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.qziedu.cn
    DocumentRoot /var/qziedu
    DirectoryIndex 学号.html

    Alias /学号 /var/学号 			#虚拟目录映射,访问 url/学号 对应的是/var/学号

    <Directory /var/qziedu>			#目录权限设置
        Options Indexes FollowSymLinks  #可以目录访问
        AllowOverride None
        Require all granted
    </Directory>

    <Directory /var/学号>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

phpmyadmin

安装EPEL存储库,因为phpMyAdmin包通常在EPEL存储库中:

sudo yum install epel-release -y

安装phpMyAdmin包:

sudo yum install phpmyadmin -y

编辑配置文件:

sudo vim /etc/httpd/conf.d/phpMyAdmin.conf

找出并注释掉带有"Require ip XXXX"字样的代码行。会有四处这样的代码行,用"Require all granted"取而代之。

vim快捷:%s/Require ip 127.0.0.1/Require all granted/g

修改完如下:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8
   DirectoryIndex index.php
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
        Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/libraries/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all denied
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from None
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all denied
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from None
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all denied
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from None
   </IfModule>
</Directory>

重启服务 httpd 服务就完成了。

标签:httpd,Deny,phpMyAdmin,Require,LAMP,实验,Allow,Apache
From: https://www.cnblogs.com/qianyuzz/p/17918595.html

相关文章

  • 实验7
    实验4#include<stdio.h>intmain(){FILE*fp;fp=fopen("d:\\data4.txt","r");if(fp==NULL){printf("failtoopenfile.\n");return1;}charch;intcnt=0;while((ch=fget......
  • 实验七
    task4code#include<stdio.h>#include<string.h>#defineN5#defineM80intmain(){charsongs[N][M];FILE*fp;fp=fopen("data1.txt","r");if(fp==NULL){printf("failtoopenfile\n......
  • 实验7
    task4代码1#include<stdio.h>23intmain()4{5FILE*fp;6fp=fopen("d:\\data4.txt","r");7if(fp==NULL){8printf("failtoopenfile.\n");9return1;10}1112ch......
  • 实验7 文件应用编程
    task4#define_CRT_SECURE_NO_WARNINGS1#include<stdlib.h>#include<stdio.h>#defineN100intmain(){FILE*fp;charn,*p;intcount=0;fp=fopen("data4.txt","r");while(feof(fp)==0){n=fgetc(fp);if(n!=''&......
  • 通用定时器及定时器中断实验
    定时器:顾名思义是用来定时的一个外设。stm32有八个定时器,分三类计数器计数模式又分为三种:向上,向下,向上/下计数。向上:计数器从零计数到自动加载值,然后重新从零开始并产生一个计数器溢出事件。向下:计数器从自动加载值计数到零,然后重新从自动加载值开始并产生一个计数器溢出事件......
  • 实验七
    task4#include<stdio.h>#include<string.h>#defineN5#defineM80intmain(){charsongs[N][M];FILE*fp;fp=fopen("data1.txt","r");if(fp==NULL){printf("failtoopenfile\n"......
  • 实验7
    task.4#include<stdio.h>intmain(){FILE*fp;intk=0;charch;fp=fopen("data4.txt","r");if(fp==NULL){printf("failtoopenfile\n");return1;}while(1){......
  • 实验7
    #include<stdio.h>#defineM80intmain(){FILE*fp;charch;fp=fopen("e:\\data4.txt","r");if(fp==NULL)printf("failtoopenfile\n");else{while(1){ch=fgetc(fp);i......
  • 实验七
    task4.c1#include<stdio.h>23intmain(){4FILE*fp;56intk=0;7charch;89fp=fopen("data4.txt","r");1011if(fp==NULL){12printf("failtoopenfile\n");13......
  • 实验七
    实验四源代码#include<stdio.h>#defineM80intmain(){ FILE*fp; charch; fp=fopen("e:\\data4.txt","r"); if(fp==NULL) printf("failtoopenfile\n"); else { while(1){ ch=fgetc(fp); if(ch==EOF) break;......