» apache の記事

~ Install Mod_GeoIP in centos ~

connie 2016.07.13 | apache | | No Comments
yum update

yum install mod_geoip GeoIP GeoIP-devel GeoIP-data zlib-devel

cd/usr/share/GeoIP/
mv GeoIP.dat GeoIP.dat_org
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz

nano /etc/httpd/conf/httpd.conf
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
</IfModule>
nano /var/www/html/testgeoip.php
<?
var_dump(getenv(GEOIP_COUNTRY_NAME))

 

Install apache module mod_headers in ubuntu

sudo a2enmod headers

Restart apache

/etc/init.d/apache2 restart

httpd.conf

Header always append X-Frame-Options SAMEORIGIN

or

Header always append X-Frame-Options DENY
/etc/init.d/apache2 restart

 

必需東西

  1. Root機(笑,未root 可以再見了
  2. Android Terminal Emulator , 即putty
  3. Hacker's Keyboard , 感覺好小小既keyboard skin,最小你會講小左好多粗口:)
  4. Complete Linux Installer , linux container
  5. Astro File , android file system

 安裝晒以上東東後,開啟 Complete Linux Installer 

去install guides 到choose 你要安裝既OS 到,尼到會用ubuntu 12.04 尼做example

Screenshot_2013-04-01-19-47-49

Page 1 主要係叫你開USB debugging mode , 同夠位donwload ubuntu OS images

Screenshot_2013-04-01-19-47-58

之後Page2 donwload image 

Screenshot_2013-04-01-19-48-01

之後有3個size可以 download , 睇餸食飯。

Screenshot_2013-04-01-19-52-28

sourceforge 係幾好,用4G download 都好快完成, (小妹係唔係就係另mobile network 塞車的兇手,喂

Screenshot_2013-04-01-19-52-31

download 完成後就解壓,內有2個file , 一個係img , 一個係md5

Astro File check 一下md5 有無問題,按實>properties>MD5 checksum

之後將img放到你想放既位置。

完成後回到Complete Linux Installer , 去launch

SETTINGS>Edit 變更images link

save> Start Linux

開了後會自動跳到Android Terminal Emulator,問你開唔開ssh, vnc, y晒佢你就有好日子過

之後save ,一切都變回你懂的東西,update 一野

apt-get upgrade && update

install LAMP

apt-get install apache2 mysql-server php5

Screenshot_2013-04-01-19-23-02

完成

~ Apache 上配置多張 SSL Cert ~

connie 2012.12.28 | ubuntu | | No Comments

有好多人會以為配置SSL virtual Host 時,會同普通http virtual Host 一樣,
copy 多一set virtual host 改servername , restart 就完成.

但你好快會發現有問題出現
假設你有2個SSL site, 同樣都有cert的.
SSL Site B 會使用了 Site A 張cert

要解決這個問題有三個可行的方法

  1. use Wildcard SSL
  2. set different port listener
  3. use mod_guntls mod

總之要點係每個SSL VirtualHost 都要有獨立的IP:PORT組合,不然就要用wildcard SSL

~ install awstats on ubuntu ~

connie 2012.12.26 | ubuntu | | No Comments
sudo apt-get install awstats

Copy the config file for new site (should name as wstats.yourdomain.ext.conf)

cp /etc/awstats/awstats.conf /etc/awstats/awstats.yourdomain.ext.conf

Open the config file, and modify these lines

#Path to access.log for your domain
LogFile="/var/log/apache2/access.log"
#I recommend '1' for more detailed information
LogFormat=1
SiteDomain="yourdomain.ext"
HostAliases="localhost 127.0.0.1 yourdomain.ext"

For running the first time use

/usr/lib/cgi-bin/awstats.pl -config=yourdomain.ext

For update

/usr/lib/cgi-bin/awstats.pl -config=yourdomain.ext -update

apache setting
 

<VirtualHost *:80>
ServerName ***.***.***.***
DocumentRoot /var/www/
<Directory "/var/www/">
Options FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
</Directory>
Alias /awstatsclasses/ "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
</VirtualHost>

/etc/init.d/apache2 reload

0 */3 * * * root /usr/lib/cgi-bin/awstats.pl -config=yourdomain.ext -update &gt;/dev/null

~ AppServ 開啟 mcrypt 方法 ~

connie 2012.12.22 | apache | | No Comments

在 AppServ 開啟 mcrypt 方法如下 :

去Appserv folder/php5/ copy libmcrypt.dll 抄去C:\windows\

然後到C:\windows\php.ini uncomment 

extension=php_mcrypt.dll

restart apache

~ 解決php load exif extension 問題 ~

connie 2012.12.18 | apache | | No Comments

當php.ini enable 左 exif extension 但還是用不到的話,
那你要看看extension=php_exif.dll,是否放得前過extension=php_mbstring.dll
因為php_exif.dll需要用到php_mbstring, 所以要放得前過extension=
php_exif.dll
restart apache 

Screen Shot 2013-01-01 at 1.04.57 PM

| HOME |