Windows 2003,IIS+Apache,两个IP,分别绑定IIS/Apache,但是只能启动一个,状况就是类似于80被占用。
解决方法:
Win2003CD找到support/tools/Support.cab,找到httpdcf.exe。然后运行:
httpcfg set iplisten –i 192.168.1.1
即将IIS绑到192.168.1.1的80端口。
httpcfg query iplisten
可以查看绑定状况。但是必须先运行前者。
Apache不需要特别设置,直接绑定即可。
另外,切忌重启服务器。否则还是不生效。
不知道微软为啥搞这么复杂。
招生的时候检测报告说俺们的web server有漏洞,于是决定把Apache+PHP升级一下。
首先看一下版本:
[root@www1 ~]# /usr/local/apache2/bin/apachectl -v
Server version: Apache/2.2.4 (Unix)
Server built: Aug 7 2008 14:07:37
php的版本可以写个phpinfo看到。装的是4.4.4。
[root@www1 ~]# /usr/local/php/bin/php -i |grep configure
Configure Command => './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib-dir' '--with-bz2' '--with-tiff-dir' '--with-gd=/usr/local/gd2' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-ttf' '--enable-mbstring' '--with-mysql=/usr/local/mysql' '--with-config-file-path=/etc' '--disable-ipv6' '--enable-static'
更多内容参照:http://www.baalchina.net/2009/08/php-mysql-apache-configure/
注意:
- ZO也要装
- 根据跑的cms程序,php升级的时候尤其是4~5切记不可太随意。不过php4在07年就停止支持了…
- 备份好conf文件,虽然一般不会有问题…
wget http://cn2.php.net/get/php-5.2.11.tar.gz/from/cn.php.net/mirror
tar xvzf php-5.2.11.tar.gz
cd php-5.2.11
'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib-dir' '--with-bz2' '--with-tiff-dir' '--with-gd=/usr/local/gd2' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-ttf' '--enable-mbstring' '--with-mysql=/usr/local/mysql' '--with-config-file-path=/etc' '--disable-ipv6' '--enable-static'
make;make install
然后搞ZO
没啥好说的…bs Zend,居然要注册才给地址
http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
另外暂时不支持php5.3.0。
然后搞Apache:
[root@www1 ~]# ./configure "--prefix=/usr/local/apache2" "--enable-module=so" "--enable-deflate=shared" "--enable-expires=shared" "--enable-rewrite=" "--enable-static-support" "--enable-static-htpasswd" "--enable-static-htdigest" "--enable-static-rotatelogs" "--enable-static-logresolve" "--enable-static-htdbm" "--enable-static-ab" "--enable-static-checkgid" "--enable-ssl" "--disable-userdir" "--with-ssl=/usr/local/openssl" "--with-apr=/usr/local/apr" "--with-apr-util=/usr/local/apr-util/bin"
[root@www1 ~]# make;make install
[root@www1 ~]# /usr/local/apache2/bin/apachectl stop
[root@www1 ~]# /usr/local/apache2/bin/apachectl start
[root@www1 ~]# /usr/local/apache2/bin/apachectl -v
打完收工。
wp的rewrite机制和之前遇到的DZ等不同,稍费了点功夫。
- 首先Apache必须要支持Rewrite,加载好mod_rewrite。
- 其次,WP处理的规则是通过wp目录下的.htaccess文件,如果请求的不是文件或者目录,就交由index.php处理。而非通过Rewrite将连接进行静态化。所有需要将这个.htaccess设置为可写属性。
- Apache要使用这个.htaccess,需要在Directory目录添加“AllowOverride FileInfo, AllowOverride All”。同时还要“FollowSymLinks option”。
参考文章:
分析WordPress的Rewrite机制
http://www.black-xstar.com/blog/article.asp?id=546
WP官网文章
http://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29
另外,Wordpress的.htaccsee内容如下:
1
2
3
4
5
6
7
| <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule> |
打造安全的CENTOS服务器---php安全
2008-08-05 22:11:13 来源:中国站长站 作者:编辑整理 【大 中 小】 评论:0 条
http://www.chinaz.com/Server/Safe/0P534HR008.html
软件配置:
httpd-2.0.52-28.ent.centos4
php-4.3.9-3.15
1、开启安全模式(做为商业应用的服务器不建议开启)
复制内容到剪贴板
代码:
#vi /usr/local/Zend/etc/php.ini (没装ZO时php.ini文件位置为:/etc/php.ini)
safe_mode = On |
2、锁定PHP程序应用目录
复制内容到剪贴板
代码:
#vi /etc tpd/conf.d irtualhost.conf |
加入
php_admin_value open_basedir /home/*** (***为站点目录)
3、千万不要给不必要的目录给写权限,也就是777权限,根目录保持为711权限,如果不能运行PHP请改为755
4、屏蔽PHP不安全的参数(webshell)
复制内容到剪贴板
代码:
#vi /usr/local/Zend/etc/php.ini (没装ZO时php.ini文件位置为:/etc/php.ini)
disable_functions = system,exec,shell_exec,passthru,popen |
以下为我的服务器屏蔽参数:
disable_functions = passthru,exec,shell_exec,system,set_time_limit,ini_alter,dl,
pfsockopen,openlog,syslog,readlink,symlink,link,leak,fsockopen,popen,escapeshell
cmd,error_log |