Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Tuesday, February 26, 2008

Apache + SSL + SVN

(Feb 26, 2008)

(previous posts:
1. Apache+OpenSSL
2. SVN + Apache
)

From my two previous posts above, I discussed about SVN + Apache and Apache + OpenSSL separately. Now, it's time to put things together.

There are two possibilities for doing this. First, we may allow users to use SVN in both secure and insecure manners. Second, we may force users to only use SVN in a secure manner.

If we want to allow both, we put SVN configuration outside secured virtual host. If we want to enforce secured SVN, just move the SVN configuration inside secured virtual host configuration.


Note: the SVN configuration I mentioned is

<Location /super_angel>
DAV svn
SVNPath E:/svn_repos/super_angel

AuthType Basic
AuthName "Subversion Super-Angel repository"
AuthUserFile c:/etc/svn-auth-file

Require valid-user

AuthzSVNAccessFile c:/etc/svn-acl
</location>

OpenSSL กับ Apache

(Feb 26, 2008)

สำหรับการติดตั้ง Apache 2.0 บน Windows ที่เราต้องการทำ self-signed certificate เราควรจะเริ่มจากการดาวน์โหลดแพคเกจ OpenSSL สำหรับนักพัฒนามาจาก http://www.slproweb.com/products/Win32OpenSSL.html

(ที่ต้องใช้แบบนักพัฒนาก็เพราะว่าเราต้องการที่จะ sign certificate เอง ถ้าดาวน์โหลดแบบ light เราจะ sign ไม่ได้
Note: if we do not use a developer package from http://www.slproweb.com/products/Win32OpenSSL.html, we might encounter a problem when we want to sign a certificate since it will look for a file bss_file.c in ./crypto/bio ... which is not available in a light package.
)

หลังจากนั้นเราก็สร้าง key กับ sign certificate ด้วยตัวเองด้วยคำสั่ง
openssl genrsa -out server.key 1024
openssl req -new -sha1 -x509 -key ca-key.pem -out server.crt -days 365

(เลขที่อยู่ด้านหลังสุดบอกจำนวนวันก่อนที่ certificate จะหมดอายุ)

เมื่อเราคัดลอกไฟล์ server.key กัล server.crt ไปไว้ในที่ๆ เหมาะสมแล้ว ก็ถึงคราวที่เราจะต้องไปแก้ไฟล์ httpd.conf ของ Apache

ขั้นแรกก็ต้อง uncomment บรรทัด LoadModule ssl_module modules/mod_ssl.so
จากนั้นไปที่ด้านท้ายของไฟล์ เราก็จะเห็น

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin


ให้เรา uncomment บรรทัด
Include conf/extra/httpd-ssl.conf ออกตามระเบียบ แล้วก็เข้าไปแก้ไฟล์ httpd-ssl.conf ซึ่งจุดสำคัญมีดังนี้
1. บรรทัด SSLMutex ควรแก้จากตำแหน่งไฟล์เป็น default
2. ตำแหน่ง certificate file (ดูบรรทัดที่มี SSLCertificateFile)
3. ตำแหน่ง key file (ดูบรรทัดที่มี SSLCertificateKeyFile)
4. DocumentRoot
5. ServerName
6. ServerAdmin

Sunday, January 13, 2008

Folder Listing in Apache

Default configuration value for folder listing in recent Apache servers seems to change. Now, by default, we cannot list folder contents without an index file. To allow folder listing without an index file, we need to set an option properly. If we start from a fresh installation of Apache 2.2, the default option is

Options FollowSymLinks

We can change it to

Options Indexes FollowSymLinks

And, directory listing will work just fine. Note: 'Deny from all' directive may still prevent us from viewing a page. We can delete or comment out the directive to view contents.

To make folder listing looks better, we should also employ fancy style by uncomment the second following line:
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

Please consult http://httpd.apache.org/docs/1.3/mod/core.html#options for details.

Monday, November 26, 2007

Server-Side Include in Apache

(Nov 26, 2007)

I tried using server-side include (SSI) feature in Apache 2.2.6. I followed all steps in its documents. These are:
1. use Options +Include in
2. use AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
within mime_module (just uncomment these two lines in httpd.conf)
3. use an include element, such as

However, it turned out that my stuff did not work. I spent about two hours to figure this out. Finally, I knew that .shtml did not mean a file to be included., but .shtml meant a file that included other files. Namely, I just renamed a 'master' file, menu.html, to menu.shtml, and every thing worked fine.

Moreover, a file to be included can be .html, no need to make it .shtml.

Note: although it is possible that we can allow .html to be a master file in the same way by adding AddOutputFilter INCLUDES .html, I will not do this since 3rd party server may not allow us to do this (I think it might slow down the web server).