apache centos配置?centos7下载地址
今天给各位分享apache centos配置的知识,其中也会对centos7下载地址进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
如何在CentOS 7服务器上利用Apache安装并hpMyAdmin
在CentOS上安装phpMyAdmin,首先需要架设一台Web服务器(如Apache或nginx),安装好MySQL/MariaDB数据库和PHP。根据你的偏好和需求,你可以从LAMP和LEMP中选择一种安装。
另一个要求是允许在你的CentOS上安装EPEL库。在CentOS6或7上安装phpMyAdmin可以通过以下命令实现。在CentOS 7上:$ sudo yum install phpmyadmin。如果需要php-mcrypt扩展,可以使用:$ sudo yum install phpmyadmin php-mcrypt。
在CentOS 7上配置phpMyAdmin,其默认情况下只允许从回环地址(127.0.0.1)访问。为了能远程连接,需要改动它的配置文件。用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉带有"Require ip XXXX"字样的代码行。会有四处这样的代码行,用"Require all granted"取而代之。重新改动过的配置文件如下所示。$ sudo vi/etc/httpd/conf.d/phpMyAdmin.conf。
AddDefaultCharset UTF-8
# Apache 2.4
#Require ip 127.0.0.1
#Require ip::1
Require all granted
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from::1
# Apache 2.4
#Require ip 127.0.0.1
#Require ip::1
Require all granted
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from::1
最后,重启httpd使改动生效:$ sudo systemctl restart httpd。
在CentOS 6上配置phpMyAdmin,默认情况下是禁止从每个IP地址访问的。为了能远程连接,你需要改动它的配置。用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpmyadmin.conf),找出并注释掉"Deny from all"字样的代码行。然后把"Allow from 127.0.0.1"字样的代码行改成"Allow from 0.0.0.0"。重新改动过的配置文件如下所示。$ sudo vi/etc/httpd/conf.d/phpmyadmin.conf。
Order Deny,Allow
# Deny from all
Allow from 0.0.0.0
下一步是将phpMyAdmin的配置文件用blowfish加密工具加密。这一步需要加密cookie里的密码来作为基于cookie的部分认证。用文本编辑器打开如下路径所示的文件并且用blowfish设置一个随机密码,如下所示:$ sudo vi/usr/share/phpmyadmin/config.inc.php。
$cfg['blowfish_secret']='kd5G}d33aXDc50!';/* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/
最后,重启httpd使改动生效:$ sudo service httpd restart(CentOS 6)或$ sudo systemctl restart httpd(CentOS 7)。
测试phpMyAdmin是否设置成功,访问这个页面:。你应该能通过Web界面来记录下任何MySQL用户(比如root)和管理MySQL/MariaDB的数据库/表。
疑难解答:在CentOS上安装phpMyAdmin的过程中遇到的一些问题解决方法。
当你在浏览器里尝试连接phpMyAdmin页面的时候,出现"403 Forbidding"错误:"You don't have permission to access/phpMyAdmin on this server."。这是因为phpMyAdmin默认阻止了IP地址远程连接。要修复这种错误,需要编辑它的配置文件来允许远程连接。具体操作见上述步骤。
当你连接phpMyAdmin页面时,出现"The configuration file now needs a secret passphrase(blowfish_secret)."信息,并且你无法登录。要修复这种错误,需要编辑/usr/share/phpmyadmin/config.inc.php这个文件来添加一个随机的blowfish密码,然后重启httpd,如下所示:$ sudo service httpd restart(CentOS 6)或$ sudo systemctl restart httpd(CentOS 7)。$cfg['blowfish_secret']='kd5G}d33aXDc50!';/* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/
当你连接phpMyAdmin页面时,出现"Cannot load mcrypt extension. Please check your PHP configuration"错误信息。要修复这种错误,需要安装下面这个包,然后重启httpd:$ sudo yum install php-mcrypt。
如何在CentOS 7上安装Apache Cassandra
首先要安装好java,并配置好java环境。现在通过创建一个新的存储库文件将Apache Cassandra存储库添加到您的存储库列表中。
nano/etc/yum.repos.d/cassandra.repo
现在将以下内容添加到文件中。
[cassandra]
name=Apache Cassandra
baseurl=
gpgcheck=1
repo_gpgcheck=1
gpgkey=
您现在可以通过运行以下命令安装Apache Cassandra。
yum-y install cassandra
通过运行以下命令重新加载系统守护程序:
systemctl daemon-reload
你现在可以通过键入来启动Cassandra
systemctl start cassandra
要启用Cassandra在启动时自动启动,请运行:
systemctl enable cassandra
您可以通过键入以下命令来验证Cassandra是否正在运行。
nodetool status
如果Cassandra正在运行,您应该看到类似的输出。
[root@ip-172-31-7-136~]# nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns(effective) Host ID Rack
UN 127.0.0.1 136.29 KiB 256 100.0% b3d26649-9e10-4bee-9b3c-8e81c4394b2e rack1
如果不是显示上面的输出,而是得到类似于以下输出的内容,那么您将需要配置cassandra环境配置文件。
nodetool: Failed to connect to'127.0.0.1:7199'- ConnectException:'Connection refused(Connection refused)'.
使用以下命令打开配置文件。
nano/etc/cassandra/default.conf/cassandra-env.sh
现在在配置中找到以下一行。
# JVM_OPTS="$JVM_OPTS-Djava.rmi.server.hostname=<public name>"
取消注释行并将其值形式<public_name>更改为localhost IP地址127.0.0.1。
配置应如下所示。
JVM_OPTS="$JVM_OPTS-Djava.rmi.server.hostname=127.0.0.1"
保存文件并从编辑器退出,通过运行以下命令重新启动Apache Cassandra。
systemctl restart cassandra
运行nodetool命令时应该具有所需的输出。
Cassandra带有一个强大的命令行shell cqlsh来在Cluster上运行查询。查询是用CQL或Cassandra Query语言编写的。要访问CQL shell,请运行以下命令。
cqlsh
您将看到以下输出。
[root@www.linuxidc.com~]# cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1| Cassandra 3.11.0| CQL spec 3.4.4| Native protocol v4]
Use HELP for help.
centos怎么查看apache安装在哪里
在centos下Apache的安装方式无非两种,源码编译安装和yum(rpm)安装,下面列出查找方式
1.查找服务安装位置通常使用查找进程的方式,适用于编译安装的apache,下面例子中可以看出来apache安装在/usr/local/httpd/下
ps-ef|egrep"apache|httpd"
root300101004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001230010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001330010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001430010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001530010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001630010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001730010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001830010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3001930010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002030010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002130010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002230010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002330010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002430010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002530010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002630010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
www3002730010004:01?00:00:00/usr/local/httpd/bin/httpd-kstart
2.如果进程中无法找到尝试在启动脚本中寻找,适用于yum安装的apache,如下所示,可以看到启动时apache加载配置文件的位置,其中apache运行的站点目录可以在/etc/httpd/conf/httpd.conf中找到
#查看apache配置文件位置
sed-n'9,11p'/etc/init.d/httpd
#config:/etc/httpd/conf/httpd.conf
#config:/etc/sysconfig/httpd
#pidfile:/var/run/httpd/httpd.pid
#查看apache站点目录
grep"DocumentRoot"/etc/httpd/conf/httpd.conf|grep-v"#"
DocumentRoot"/var/www/html"
3.通过编译参数查找
apache_bin=$(find/-typef-name"httpd"|xargs-ils-l{}|awk'{if($5>30000)print$NF}')
$apache_bin-V|grepHTTPD_ROOT
结果:-DHTTPD_ROOT="/etc/httpd"
#apache安装在/etc/httpd目录下