Build secure web server
Reference :**--------------------------
Do not remove the server service
ps-ax
which rpc.statd
mv / sbin / rpc.statd
mkdir / var / back.ps
mv / sbin / rpc.statd / var / back.ps
/ Etc / rc.d / init.d / nfs stop
mv / etc / rc.d / init.d / nfs / var / back.ps /
rpm-qa | grep httpd
rpm-e system-config-httpd-1.2.0-3
rpm-e httpd-2.0.49-4
rpm-qa | grep nfs
rpm-e system-config-nfs-1.2.3-2
rpm-e nfs-utils-1.0.6-20
/ Etc / rc.d / init.d / xinetd stop
which xinetd
/ Usr / sbin / xinetd
mv / usr / sbin / xinetd / var / back.ps /
//------------------------------
updatedb
locate init
//---------------------- Not start graphical interface ------------
vi / etc / inittab
# Ca:: ctrlaltdel: / sbin / shutdown-t3-r now
ca:: ctrlaltdel: / usr / bin / top
# Run xdm in runlevel 5
id: 3 ********
x: 3: respawn: / etc/X11/prefdm-nodaemon
reboot
//------------------------- Iptables --------------
vi iptable_
iptables-t filter-A INPUT-p tcp - dport 80-j ACCEPT
iptables-t filter-A INPUT-p tcp - dport 22-j ACCEPT
iptables-t filter-A INPUT-p tcp - dport 20-j ACCEPT
iptables-t filter-A INPUT-p tcp - dport 21-j ACCEPT
iptables-t filter-A INPUT-p tcp - dport 3306-j ACCEPT / / optional
iptables-t filter-A INPUT-p tcp-j DROP
iptables-t filter-A INPUT-p udp-j DROP
//--------------------------- Apache 2.0 --------------
. / Configure - enable-ssl - enable-so - enable-cgi
make
make install
AddDefaultCharset GB2312
Listen 218.246.33.61:80
ServerTokens Prod
ServerSignature Off 538
DirectoryIndex index.html index.html.var index.php 386
NameVirtualHost 192.168.1.151:80 1058
//-------------- MPM ---------------------------------
<IfModule Prefork.c>;
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 2000
MaxClients 1500
MaxRequestsPerChild 10000
</ IfModule>;
<VirtualHost **.**.**.**:80>;
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /******/
ServerName www .***.***
ErrorLog logs / dummy-host.example.com-error_log
CustomLog logs / dummy-host.example.com-access_log common
</ VirtualHost>;
AddType application / x-httpd-php. Php 852
//--------------------- Install mysql4.0-----------------
tar-zxf gd-2.0.33.tar.gz
. / Configure
make
make install
tar-zxf mysql-4.0.22.tar.gz
- With-charset = GB2312
- Prefix = / var / local /
. / Configure - with-charset = GB2312 - prefix = / var / local /
vi / Docs / mysql.info 7086
shell>; groupadd mysql
shell>; useradd-g mysql mysql
shell>; gunzip <mysql-VERSION.tar.gz | tar-xvf -
shell>; cd mysql-VERSION
shell>;. / configure - with-charset = GB2312 - prefix = / var / local /
shell>; make
shell>; make install
shell>; cp support-files/my-medium.cnf / etc / my.cnf
shell>; cd / usr / local / mysql
shell>; bin / mysql_install_db - user = mysql
shell>; chown-R root.
shell>; chown-R mysql var
shell>; chgrp-R mysql.
shell>; bin / mysqld_safe - user = mysql &
//-------------------------------- Install php4 .**----------- -----------------
php
. / Configure - with-apxs2 = / usr/local/apache2/bin/apxs - with-zlib-dir - with-mysql
make
make install
cp php.ini-dist / usr / local / lib / php.ini
; Safe_mode = Off
safe_mode = On
; Display_errors = On
display_errors = On
; Log_errors = Off
log_errors = On
/****
extension_dir = ". /"
disable_functions = phpinfo, get_cfg_var, exec, system, eval
//------------------------------- Ssh configuration
vi / etc / ssh / sshd_config
root user can not directly log in
# PermitRootLogin yes
PermitRootLogin no
Does not allow empty password
# PermitEmptyPasswords yes
PermitEmptyPasswords no
/ Etc / rc.d / init / sshd restart
Please sign that when you have a copy:
Xefee hosting<<Build secure web server>>:http://www.xefee.com/article-1328-1.html
