albtechportal

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 28 May 2013

Configure a Production Web Server

Posted on 03:40 by Unknown
Setup a FreeBSD production Web Server

Here is presented the quick way, using packages. If you really want a secure
web server and also you have a lot of time, than you should install
Apache from ports and patch it.

1. Install FreeBSD version 5.4 and needed packages

--------------------------------------------------
(do not install X.org, install ports also)

1.1 Install Apache
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/apache-1.3.33_1.tbz

add apache_enable="YES" in rc.conf to start apache at boot

1.2 Install PHP
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-4.3.10_2.tbz

Add the following line to your apache configuration file (/usr/local/etc/apache/httpd.conf):

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

1.3. Install PHP extensions
1.3.1 Install gd extension for PHP

It is important to install some PHP extensions so you could host PHP scripts that will need that modules, for different purposes (PNG or JPEG conversion for example).

#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-gd-4.3.10_2.tbz

(it will also automaticaly install library for manipulating PNG files and JPEG library)
(some other libraries will be installed, following dependencies)

1.3.2 Install MySQL shared extension for PHP

#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-mysql-4.3.10_2.tbz

This pkg_add command will also install MySQL client.
(mysql-client-4.0.24.tbz)

1.3.3 Install pcre shared extension for PHP
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-pcre-4.3.10_2.tbz

1.3.4 Install session shared extension for PHP
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-session-4.3.10_2.tbz

1.3.5 Install XML shared extension for PHP
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-xml-4.3.10_2.tbz

1.3.6 Install zlib shared extension for PHP
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/php4-zlib-4.3.10_2.tbz

1.4. Install MySQL Server
#pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/All/mysql-server-4.0.24.tbz

At this point you should setup a root password for mysql.
(MySQL also store passwords for users, different from unix system accounts)

2. Optimizing your Web Server for speed
Add the following settings to your /boot/....
kern.ipc.nmbclusters=16384
kern.ipc.maxsockets=16384

For a maximum performance here are some tips of optimizing your web server:
- use a dedicated server  (stability, performance,)
- use enough memory (1 GB or more, but not less)
- set httpd controls very high (maximul simultaneous connections)
- always knows your performance characteristics, monitor your server to discover
bottlenecks
- in Apache httpd.conf, StartServers should be high (default is 5 but is not enough),
MaxClients should be 256, MaxRequestPerChild should be 10000, disable FancyIndexing, set Timeout - timeout
to get a TCP ACK for a complete GET request to 60 (default is set to 300).

3. Security issues
- Install a firewall, block traffic to all ports, except 80.
- The Apache web server must be the only service available on the server
(of course we will also have mysql)
- Turn off any diagnostic/error message webpage (security by obscurity)
- Apache must have limited access to filesystem

Monitor user actifity, looking for PHP scripts, if you host phpbb2 or other forums,
or CMS programs like PostNuke, PHPNuke, Mambo always keep your scripts updated.
Deactivate shell for all users except admin user (not root, root does not have default access
to ssh) (add 'AllowUsers username' to /etc/ssh/sshd_config so only username will have ssh access).
Permit SSH for that user only from known IPs.
Use /etc/ftpchroot to force users that have ftp account to see only their home directory.
(some admins even deactivate ftp since is unencrypted service, but major hosting
companies permit ftp because is used on large scale to upload files by their customers.

Remember: using PHP JSP and CGI may pose security threats.
(scripts could contain security vulnerabilities, like sql injection, also vulnerabilities
can be found in packages like php, modules etc.)

Installing Zend Optimizer
If you run scripts on your web server that are encoded with Zend Encoder (or want to offer to your customer support for Zend encoded PHP scripts) you should install Zend Optimizer, downloaded for free from www.zend.com (you will need to create an account).
After downloading Zend Optimizer, unzip it and run install.sh.

On FreeBSD 5.4 you might get an error when installing Zend Optimizer:
/usr/libexec/ld-elf.so.1: Shared object "libm.so.2" not found, required by "php"

To fix the problem and go on with installation just create a symbolic link:
#ln -s /lib/libm.so.3 /lib/libm.so.2
then continue with Zend installation.

Now you have an ready to use Web Server.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Linux | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Review: Seagate 600 480GB SSD
    Seagate Joins the Fray It’s been quite an interesting turn of events over the past couple years in the storage industry. Whereas practical...
  • Top 10 Ways to Customize Your Desktop
    1 Expand You spend a lot of waking hours at your computer, so why not make it a little prettier (and more productive)? Here are 10 ways to...
  • CCBoot - LAN Boot Software for Windows
    LAN Boot Solution Background LAN boot is a technology based on IP (Internet Protocol), UDP (User Datagram Protocol), DHCP (Dynamic ...
  • ‘Strata’ for iOS and Android game review
    There are games that are fun. There are games that look great. And then there are games that do both. Strata is one such game that h...
  • Adobe Photoshop CS6 Extended 13.0 & Plugins + Textures
    Adobe Photoshop CS6 Extended 13.0 & Plugins + Textures | 3.5 GB Adobe Photoshop CS6 Extended software delivers even more imaging magi...
  • Intel NUC DC53427RKE / HYE Review
    Manufacturer: Intel UK Price (as reviewed): £308.32 (inc VAT) US Price (as reviewed): $539.99 (ex TAX) Preferred Partner Price: £308.32...
  • ASUS R9 270X DirectCU II TOP 2 GB
    AMD's new Radeon R9 270X draws its lineage more from the Radeon HD 7800 series than any other. The R9 270X is, for all intents and purp...
  • Corsair Raptor M40 Review
    Manufacturer: Corsair UK price (as reviewed): £44.99 (inc VAT) US price (as reviewed): $59.99 (ex Tax) Along with the Raptor M30, Corsai...
  • Call of Duty: Ghosts Review
    Developer: Infinity Ward Publisher: Activision Platforms: PC, X360, PS3, PS4, Xbox One Price: £39.99 Reviewing a Call of Duty game is a ...
  • How to remotely install apps on your smartphone
    You can download and install apps to your iPhone and Android phone without being anywhere near it. That sorcery is this? It isn't sorce...

Categories

  • Android
  • Apple
  • Audio
  • Blogger
  • C/C++
  • Cabling
  • Cameras
  • Cases
  • CISCO
  • Cooling
  • CPU
  • Desktop
  • DNS
  • Ebook
  • Fiber Optic
  • Gadgets
  • Game
  • Google
  • Graphic Card
  • Hardware
  • HDD
  • HTC
  • HTMLCSS
  • Hyper-V
  • Intel
  • iOS
  • iPad
  • Iphone
  • IT
  • jQuery
  • Laptop
  • Linux
  • Mac
  • MacTut
  • Microsoft
  • Mobile
  • Mouse
  • Networking
  • News
  • Nexus
  • Nokia
  • Nvidia
  • OS
  • PERIPHERALS & COMPONENTS
  • Photoshop
  • Printers
  • Programming
  • Projectors
  • PS4
  • Ram
  • RedHat
  • Review
  • Samsung
  • Scanners
  • Seagate
  • Security
  • Server2008
  • Server2012
  • Servers
  • Smartphone
  • Software
  • Sony
  • Storage
  • Tablets
  • TechNews
  • Template
  • Tutorials
  • TV
  • Ubuntu
  • Voip
  • Webdesign
  • Webiste
  • WebServer
  • Win7
  • Win8
  • Windows Phone
  • Wordpress
  • Workstation
  • XBOX

Blog Archive

  • ▼  2013 (495)
    • ►  December (35)
    • ►  November (332)
    • ►  October (12)
    • ►  September (27)
    • ►  August (2)
    • ►  July (10)
    • ►  June (42)
    • ▼  May (35)
      • What is Windows Blue and What Does it Mean for us?
      • Test and Preview Blogs Offline with Instant WordPress
      • With an SSD, backups are more important than ever
      • Even new PCs can have problems
      • Five steps to ultimate Firefox security
      • Staying ahead of the crowd with 4G connection tech...
      • Zoho CRM Review: Best Web Based Project Management...
      • What is Fiber Optics and its importance in the bro...
      • Top 5 Android keyboards that help you to type faster
      • Configure a Production Web Server
      • Designing An Open-Source iPhone Game
      • Ten Things Every WordPress Plugin Developer Should...
      • How To Do Your Research Before You Download Free S...
      • Can I Control a Phone with My Computer? [Android]
      • The Quest For The Best Nexus 4 Case: 6 Cases Teste...
      • Cool Websites and Tools [May 27th 2013]
      • 4 Websites To Play NES Games For Free & Through Th...
      • Getting to Know the OSI Model for the CCNA Exam
      • Components of a Server Computer
      • Installing and Configuring DNS
      • How to Create a PC Network Workgroup
      • Everything You Need To Know About the Blue Screen ...
      • How to Migrate Your Google Account to a New One
      • Locate and eradicate duplicate photos on your Mac
      • How to run Google Glass on your Android device
      • Carbon v1.0.3 Themeforest Responsive WordPress Theme
      • iStat Menus 4.05 MacOsX
      • USB Universal 3 (x86/x64)
      • Windows 7 SP1 and Windows 8 SuperAIO 40in1 English
      • Internet Download Manager 6.15
      • Adobe Photoshop CS6 Extended 13.0 & Plugins + Text...
      • Nero 12 HD Suite Platinum
      • CCleaner 4.02.4115 Business/Professional
      • Best smartphones: the ten best mobiles
      • Philips DesignLine television review
Powered by Blogger.

About Me

Unknown
View my complete profile