正在启动 httpd:httpd: apr_sockaddr_info_get() failed for luoqingPC
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
PHP Fatal error: Unknown: Failed opening required '/var/www/html/get_php_info.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
Listen 81
ServerAdmin xxxxxx@126.com
DocumentRoot /xxxx/xxxx/xxxxx/wordpress
ServerName *.81
ErrorLog logs/wordpress-error_log
CustomLog logs/wordpress-access_log common
<Directory "/xxxx/xxxx/xxxxx/wordpress">
Options Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
也可以将上述的配置放置在/etc/httpd/conf.d/vhost.conf中, httpd.conf会自动包含../conf.d/*.conf.
现在我有两台电脑,通过两台电脑来模仿客户端-服务器端的访问方式。通过在client端的浏览器中输入http://server-ip:port来访问服务器端的网站,注意将服务器端的防火墙进行关闭。在进行访问的时候,可能会弹出Forbidden 403的错误,错误信息显示you have no access to… 可以通过查看apache的访问日志来判断是不是Document Root文件夹的访问权限不够还是httpd的配置文件中对某些ip进行了限制,将Deny From All修改为Allow From All。注意文件夹权限需要重根目录开始设置 chrom -R o+x /usr
具体可以参见如下链接:http://download.zdnet.com.cn/download/2011/0922/2058738.shtml
在模拟client-server的过程中,除了遇到上述问题,在client端访问设置在默认站点下的wordpress的时候,链接跳转老是跳转到localhost,在网上百度了下,需要在wordpress的管理后台设置链接地址。
具体参见:http://blog.iyunv.com/lincyang/article/details/7200139
phpMyAdmin本来是非常容易安装的,只需要将phpMyAdmin安装文件夹放置在默认站点目录/var/www/html/下即可,然后通过http://localhost/phpMyAdmin来进行访问。
但是我的安装却是一波三折。我依然采用yum来进行安装,“yum -y install phpMyAdmin”安装phpMyAdmin之后,
(1)通过命令“mv /usr/share/phpMyAdmin /var/www/html/. ”将phpMyAdmin的文件夹移动到默认站点目录下。
(2)通过http://localhost/phpMyAdmin访问mysql数据库,输入用户名和密码之后成功访问,并且在另外一台局域网的电脑http://server-ip/phpMyAdmin也成功访问。
于是比较作的小青青又想着如何让mysqld服务开机启动,于是进行了简单设置,对服务器进行重启。悲伤的故事发生了…重启之后,mysqld服务没有成功开机自动启动,而且通过http://localhost/phpMyAdmin访问出现Not Found on the Server的错误,并且在client端通过http://server-ip/phpMyAdmin访问出现”you have no access to ./phpMyAdmin”的403错误,同时我的synergy服务也不好使了,突然有一种看到自己搭起的小房子瞬间坍塌的赶脚,有一股想哭却哭不出来的冲动。
于是乎小青青擦干眼泪,看apache的访问日志/var/log/httpd/error_log, 惊奇的发现其访问的是/usr/share/phpMyAdmin, 去看配置文件,惊奇的发现/etc/httpd/conf.d/phpMyAdmin.conf文件的存在。原来电脑重启前可以成功访问,是因为apache的服务没重启。其访问的是/var/www/html/phpMyAdmin。电脑重启后,apache服务也自动重启,其包含了phpMyAdmin.conf,所以其访问的是/usr/share/phpMyAdmin. 于是乎两种解决方案出来了。经测试两种方案都可成功访问phpMyAdmin。
方法1:将/usr/share/phpMyAdmin移动到默认站点目录var/www/html/, 并且将 phpMyAdmin.conf配置文件从apache配置目录/etc/httpd/conf.d中移除.
方法2:修改phpMyAdmin.conf 的权限,如下截图所示:
1
2
3
4
5
6
7
8
9
10
11
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
修改如下
Order Deny,Allow
Allow from All
#Deny from All
#Allow from 127.0.0.1
#Allow from ::1