Network Uptime yüzdesi hesaplama yöntemi

August 15th, 2010 admin Posted in Hosting & IIS7 No Comments »

Bir çok datacenter Network uptime için %99,99 gibi değerler verirler. Peki %99,99′luk değerin, yılda kaç dakikalık kesintiye karşılık geldiğini biliyor musunuz? Hemen alttaki tablodan göz atalım:

Tabi her veri merkezi, 9′la biten uptime oranları vermeyebilir. Şimdi elinizde bulunan uptime oranına göre yılda kaç saat kesinti yaşayabileceğinizi hesaplayalım.

1 yıl 365 gün x 1 gün 24 saat = 8760 saat eder. Yani 1 yıl 8760 saate eşit oluyor. Örneğin uptime garantisi 99,5 olsun. Bu durumda hesaplama aşağıdaki gibi olmalı.

8760 – (8760 * (99,5 / 100)) = 43,8 saat

Hesaplamada sadece 99,5 olan kısma uptime oranını yazmanız, sonucu bulmanız için yeterli olacaktır. 99,5 uptime oranında, yıllık maksimum 43,8 saatlik bir kesintinin olabileceği öngörülüyor. Bu değeri 12′ye bölmeniz halinde, aylık kesinti süresini; 48′e bölmeniz durumunda haftalık kesinti süresini bulabilirsiniz.

AddThis Social Bookmark Button

Windows SMTP server üzerinde Basic Authentication

August 7th, 2010 admin Posted in Hosting & IIS7, Windows Server No Comments »

Radore Hosting’te son olarak Cluster mimarisinde çalışan SMTP servisini hizmete aldım. Tabi güvenlik gereği Relay ayarlarını çok dikkatli yapmam gerekiyordu. Bu yüzden her site için ayrı bir kullanıcı ayarlamak gerekiyordu. Kullanıcı için de Active Directory yapısını kullanarak, yeni kullanıcı açma probleminden kurtulmuş oldum. Böylece müşterilerin FTP kullanıcıları, SMTP için kullanılabilir hale geldi. Şimdi SMTP üzerinde neler yapmamız gerektiğine göz atalım.

Öncelikle SMTP ayarlarında bulunan Access tabına geçiş yapalım. Access tabının altında bulunan Authentication bölümüne tıklayın ve karşınıza çıkacak menüden Basic Authentication seçeneğini seçin.

Bu bölümü Apply diyerek kaydettikten sonra yine Access tabı altında bulunan “Connection” kısmına giriş yapın ve sunucularınızın bağlı bulunduğu ip aralığını girin. Böylece dışardan erişimi engellemiş olacaksınız.

Son olarak yine “Access” tabı altından Relay ayarlarına giriş yapın.

Yukarda görebileceğiniz gibi “Allow all computers which successfully authenticate to relay, regardless of the list below” seçeneğini işaretleyin. Bu ayarları yaptıktan sonra bu sunucunuzu sadece kullanıcı adı ve şifre ile Relay’a açmış olacaksınız. Kullanıcı adı ve şifre uygulamasının çalışıp çalışmadığını telnet üzerinden aşağıdaki gibi test edebilirsiniz.

1
2
3
4
5
6
7
8
9
10
telnet 127.0.0.1 25
Helo
Ehlo
AUTH Login
eXVzdWZvenR1cmtpbmZv (kullanıcı adı)
eXVzdWY (sifre)
mail from: yusuf.ozturk@domain.com
rcpt to: yusuf@domain.com
Test maili
.

Test amaçlı denemede, kullanıcı adı ve şifre Base64′e göre şifrelenmelidir.

Yukardaki bağlantı üzerinden ücretsiz olarak şifreleme yapabilirsiniz.

AddThis Social Bookmark Button

PHP hatalarının IIS7 üzerinde gösterilmesi

August 2nd, 2010 admin Posted in Hosting & IIS7 No Comments »

Default olarak PHP on Windows’ta PHP hatalarını IIS üzerinde detaylı olarak göremezsiniz. Bunun için PHP ve IIS ayarları üzerinde bazı değişiklikler yapmanız gerekir. Bunları gösterecek olursak;

İlk olarak IIS üzerinden Detailed Errors’u açmamız gerekecektir. Bunun için IIS altından;

Error Pages ikonuna tıkladıktan sonra açılan kısımdan “Edit Feature Settings” bölümüne tıklayın.

Açılan menüden “Detailed Errors” bölümünü işaretleyin.

Sonrasında Handler Mappings’e giriş yapın.

PHP-Fastcgi yapılandırmasını bulup, üzerine sağ tıklayıp, “Edit” diyin.

Açılan menüden “Request Restrictions” bölümüne tıklayın. Karşınıza gelen bölümden;

“Invoke handler only if request is mapped to” bölümünü işaretleyip, File seçeneğini aktif bırakın.

Sonrasında php.ini dosyasının içersinden aşağıdaki bölümü bulun;

1
2
3
4
5
6
7
8
9
10
; Off          - Do not display any errors 
; stderr       - Display errors to STDERR (affects only CGI/CLI binaries!)   
; On or stdout - Display errors to STDOUT (default)
;  
; To output errors to STDERR with CGI/CLI:              
;display_errors = "stderr"
;
; Default
;
display_errors = Off

Yukardaki bölümden display_errors kısmını “On” olarak değiştirin ve IIS’i resetleyin. Bu işlemler sonrası PHP hatalarını IIS üzerinde gösterebiliyor duruma geleceksiniz.

AddThis Social Bookmark Button

Plesk 9.5.2 supports Microsoft SQL Server 2008 R2?

May 23rd, 2010 admin Posted in Hosting & IIS7 No Comments »

Yes, Plesk 9.5.2 supports Microsoft SQL Server 2008 R2 x64. I haven’t tested it with Powerpack but you can install Plesk 9.5.2 on MSSQL Server 2008 R2. I’ll share screenshots and results from this page later.

I’ll update this post asap.

AddThis Social Bookmark Button

PHP 5.3.X and phpMyAdmin blank page issue on Windows Server 2008 R2

May 15th, 2010 admin Posted in Hosting & IIS7 No Comments »

Today, i discovered you can’t use phpmyadmin on PHP 5.3.X because a dns issue. If you use PHP 5.3.X, you should follow the steps:

1. Go to hosts file and open with notepad:

C:\Windows\System32\drivers\etc\hosts

2. Remove the comment (#) in front of 127.0.0.1
3. Done! Now you can use phpMyAdmin :)

Another option, you can set 127.0.0.1 instead of localhost from config.inc.php in phpmyadmin.

AddThis Social Bookmark Button

Perl and Geo-IP Installation on Windows for AWStats

April 25th, 2010 admin Posted in Hosting & IIS7, Windows Server 2 Comments »

It’s always a real nightmare to install Geo-IP for AWStats on Windows for me. Because finding geo-ip ppd file is too hard on the internet. Also if your version is not compatible with Perl version, you can’t install it. So i decided to write a post about this to help people who have same trouble with me. I’ll be very simple.

First, download Perl from here and install it (use x86 version):

Then open a cmd, then type this to update your db:

C:\Perl\bin\ppm.bat

Now, you are ready to install Geo-IP PurePerl:

ppm install http://www.yusufozturk.info/tools/Geo-IP-PurePerl.ppd

I hope it works for you. I installed this on Windows Server 2008 R2 and it works well.

AddThis Social Bookmark Button

Calculating daily bandwidth usage of websites on IIS7.5 with Powershell

April 18th, 2010 admin Posted in Hosting & IIS7, Windows Powershell No Comments »

First, you need IIS Log Parser 2.2 to parse log files and calculate daily usage. Then we will get list of websites with Powershell and write bandwidth usages into a file.

Download IIS Log Parser v2.2:

Install IIS Log Parser v2.2. I created a new directory in drive D called LogParser and copied 2 files (logparser.dll and logparser.exe) into that directory. Now let’s see Powershell codes how to use LogParser v2.2 with Powershell.

1
2
3
4
5
6
7
8
9
10
11
12
Import-Module WebAdministration
Websites = Get-Website *
Foreach ($i in $Websites)
{
$Name = $i.Name
$ID = $i.ID
$PhysicalPath = $i.PhysicalPath
$Date = (Get-Date).AddDays(-1).ToString("yyMMdd") + '.log'
$Bandwidth = &'D:\tools\LogParser\LogParser.exe' "Select Div(Sum(sc-bytes),1048576) As Bandwidth From '$PhysicalPath\W3SVC$ID\u_ex$Date'" -q:ON
$Value = "$Name : $Bandwidth"
Add-Content -Path Bandwidth.txt -Value $Value
}

You see how easy it is? But this is just an example. I don’t care about Log Path. You should edit path for your own environment. Have fun!

AddThis Social Bookmark Button

Creating New FTP User on Active Directory with Powershell

March 2nd, 2010 admin Posted in Hosting & IIS7, Windows Powershell, Windows Server No Comments »

Creates a new user on Active Directory and sets “Password never expires”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Function Add-FTPUser
{
Param ($FTPUsername, $FTPPassword)
 
    $ADDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $ADDomainName = $ADDomain.Name
    $ADServer = ($ADDomain.InfrastructureRoleOwner.Name.Split(".")[0])
    $FQDN = "DC=" + $ADDomain.Name -Replace("\.",",DC=")
    $ADDomain = [ADSI] "LDAP://$ADServer/$FQDN"
    $CustomerOU = [ADSI] "LDAP://$CustomerOU,$FQDN"
    $User = [ADSI] "LDAP://CN=$FTPUsername,$CustomerOU,$FQDN"
    $PrincipalName = $FTPUsername + "@" + $ADDomainName
    $AddADUser = $CustomerOU.Create("User","CN=$FTPUsername")
    $AddADUser.Put("Description", "$FTPUsername")
    $AddADUser.Put("sAMAccountName", "$FTPUsername")
    $AddADUser.Put("userPrincipalName", "$PrincipalName")
    $AddADUser.Put("DisplayName", "$FTPUsername")
    $AddADUser.SetInfo()
    $AddADUser.SetPassword($FTPPassword)
    $AddADUser.SetInfo()
    $AddADUser.Psbase.Invokeset("AccountDisabled", "False")
    $AddADUser.SetInfo()
    $AddADUser.Put("userAccountControl", "65536")
    $AddADUser.SetInfo()
}

I didn’t change Primary Group of my FTP user. Because I don’t need for ACL.

AddThis Social Bookmark Button

Creating New IIS User on Active Directory with Powershell

March 2nd, 2010 admin Posted in Hosting & IIS7, Windows Powershell, Windows Server No Comments »

Creates a new user on Active Directory, sets “Password never expires” and changes primary group of user.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Function Add-IISUser
{
Param ($Username, $Password)
 
    $ADDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $ADDomainName = $ADDomain.Name
    $ADServer = ($ADDomain.InfrastructureRoleOwner.Name.Split(".")[0])
    $FQDN = "DC=" + $ADDomain.Name -Replace("\.",",DC=")
    $ADDomain = [ADSI] "LDAP://$ADServer/$FQDN"
    $CustomerOU = [ADSI] "LDAP://$CustomerOU,$FQDN"
    $User = [ADSI] "LDAP://CN=$Username,$CustomerOU,$FQDN"
    $PrincipalName = $Username + "@" + $ADDomainName
    $AddADUser = $CustomerOU.Create("User","CN=$Username")
    $AddADUser.Put("Description", "$Username")
    $AddADUser.Put("sAMAccountName", "$Username")
    $AddADUser.Put("userPrincipalName", "$PrincipalName")
    $AddADUser.Put("DisplayName", "$Username")
    $AddADUser.SetInfo()
    $AddADUser.SetPassword($Password)
    $AddADUser.SetInfo()
    $AddADUser.Psbase.Invokeset("AccountDisabled", "False")
    $AddADUser.SetInfo()
    $AddADUser.Put("userAccountControl", "65536")
    $AddADUser.SetInfo()
    $DomainNC = ([ADSI]"LDAP://RootDSE").DefaultNamingContext
    $DomainUsers = [ADSI]"LDAP://CN=Domain Users,CN=Users,$DomainNC"
    $DomainUsers.GetInfoEx(@("primaryGroupToken"), 0)
    $OldGroupToken = $DomainUsers.Get("primaryGroupToken")
    $DomainGuests = [ADSI]"LDAP://CN=IIS_USERS,CN=Users,$DomainNC"
    $DomainGuests.GetInfoEx(@("primaryGroupToken"), 0)
    $NewGroupToken = $DomainGuests.Get("primaryGroupToken")
    $DomainGuests.Add([String]($AddADUser.AdsPath))
    $AddADUser.Put("primaryGroupId", $NewGroupToken)
    $AddADUser.SetInfo()
    $DomainUsers.Remove([String]($AddADUser.AdsPath))
}

Our new Primary Group is IIS_USERS as you see. You can change that group name.

AddThis Social Bookmark Button

Getting Active Directory Information with Powershell

March 2nd, 2010 admin Posted in Hosting & IIS7, Windows Powershell, Windows Server No Comments »

My script works on all Active Directory Infrastructures without any change on script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Function Get-ADInfo
{
    $ADDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $ADDomainName = $ADDomain.Name
    $Netbios = $ADDomain.Name.Split(".")[0].ToUpper()
    $ADServer = ($ADDomain.InfrastructureRoleOwner.Name.Split(".")[0])
    $FQDN = "DC=" + $ADDomain.Name -Replace("\.",",DC=")
 
    $Results = New-Object Psobject
    $Results | Add-Member Noteproperty Domain $ADDomainName
    $Results | Add-Member Noteproperty FQDN $FQDN
    $Results | Add-Member Noteproperty Server $ADServer
    $Results | Add-Member Noteproperty Netbios $Netbios
    Write-Output $Results
}

Usage is pretty simple:

Get-ADInfo

Thats all! :)

Getting Netbios name:

(Get-ADInfo).Netbios

Getting FQDN:

(Get-ADInfo).FQDN

Getting Active Directory Domain Name:

(Get-ADInfo).$ADDomainName

Getting Active Directory Primary Server Name:

(Get-ADInfo).$ADServer

You can use this in your all scripts. You no longer need any active directory information.

AddThis Social Bookmark Button