Web Serving

You are currently browsing the archive for the Web Serving category.


macosxhints.com - 10.5: Enable https on 10.5’s Apache2 web server

This short how-to explains how to get HTTPS/SSL working on Leopard, which uses apache2. First, follow the steps in this hint, but instead of following Step 5, do the following:
Edit /private/etc/apache2/httpd.conf, and uncomment the following line (it’s line 473 in my installation):

Modify as necessary for macports conf/certs

This page Using mod_ssl on Mac OS X is also quite good, useful, handy, whatever.

sudo ipfw add deny src-ip 123.45.67.89, 127.0.0.1/8

That should do the trick.

Mac OS X Server 10.3.9

How do I know where a “visitor” is coming from?

The most commonly found method is to look at the server setting (let’s use PHP-speak here) REMOTE_ADDR.

That’s all well and good, unless you have turned on the web performance cache for any web site being served.
When you enable the performance cache Apache now returns REMOTE_ADDR in HTTP_PC_REMOTE_ADDR.
Anything that looks at REMOTE_ADDR will get the IP address of the server itself.

SPAM blockers, poll runners, anything that wants to know about who is talking to you. Wordpress, etc.

Oh, yes, as a side note: when you enable the web performance cache using ServerAdmin the httpd.conf file and all of the site conf files get re-written. Especially fun is the fact the PHP4 gets re-enabled if you have had it turned off.
Talk about scratching your head for a while.

Geeklog - Server:

I found an interesting performance tweek that was staring at me the whole time. After noticing 2-4 second delays in page rendering before geelog would load (I noticed geeklog said it loaded in, say .91 seconds yet from the time I hit enter on the web page, it tool 4-7 seconds to load).

For those using Apache, you MUST list index.php first as your DirectoryIndex . This one fix jumped my render time from 4-7sec to the true .91 sec. Mine looks like this now:

DirectoryIndex index.php index.htm index.html

Take care and happy GL’ing.

I was looking for something else and this little note caught my eye.
Why not try it and see what happens?

Load all the PHP home pages.
Swap the pair (.html / .php).
apachectl graceful
Yes, wall clock time to load pages is shorter.

Who knew?

StorageMojo » Everything You Know About Disks Is Wrong:

Which do you believe?

Costly FC and SCSI drives are more reliable than cheap SATA drives.
RAID 5 is safe because the odds of two drives failing in the same RAID set are so low.
After infant mortality, drives are highly reliable until they reach the end of their useful life.
Vendor MTBF are a useful yardstick for comparing drives.

MarsEdit: Easy weblog editing.

Optimizing an Xserve for Web Hosting

A single Xserve is ideally suited for smaller scale Web hosting, where the task is to host a handful of moderate-traffic sites. (With a fleet of Xserves, you could host an eBay or an Apple.com, but that’s a topic for another article.) The Xserve’s Apache Web server software has a multitude of configuration options. In this article, I will go over how to set up Apache to serve multiple Web sites from the same machine—so-called “virtual hosting.” I will also look at ways to optimize the server’s setup for fast, robust Web hosting. This article assumes that you have already followed the steps in the Mac OS X Server Administrator’s Guide to start Web service. (You can find the Guide on the Mac OS X Server Manuals page.)

Enterprise Mac | InfoWorld | Kill two Windows servers with one Xserve | December 21, 2006 03:07 PM | By Tom Yager

At its core, Xserve is a two-socket Core microarchitecture Xeon (Woodcrest) rack server. As I wrote in my review, in hardware design, Xserve lives up to market standards. Some touches, like the SAS/SATA drive bays, a PCI-X slot for existing expansion cards and the SuperDrive dual-layer DVD burner, help tip the scale in Xserve’s favor. But the reason to buy Xserve is OS X Server: No other server app platform rivals it, and no other server system runs it. If you want OS X Server, you need a Mac, and Xserve is the only Mac that’s equipped with external drive bays and a baseboard management controller.

So, I got my PHP 5 to work, and talk to MySQL.
I wonder if Netjuke works? Nope. Not at all.

Everywhere I read I see that Netjuke is not supported and will never work on PHP 5. Use Jinzora they say. Uck - that wasn’t fun.

Simply put. Fix “play.php” to only output one header at a time. Search for the header() call. It’s pretty obvious.

Change the test in the config.inc.php for
`PRIVATE == true`
to be something like
`NJPRIVATE == true`

Fix every file that has a
`define(”PRIVATE”, true/false)`
to be a
`define(”NJPRIVATE”, true/false)`

private is a reserved word in PHP 5.

That’s all it took. All of about 30 minutes once I decided to ignore all of the advice on the web.

Classic maintenance programming attack.

10.3.9 - no help beyond 4.3.11 from Marc Liyanage.

Apple’s 4.4 is of no help - no GD support, missing other things - PEAR, XML things, etc.

How do I make a compatible build?

Start with Apple’s configure command (use phpinfo() on a standard installation). It *will* screw up your system files nicely, so make sure you know what each of the files and directories means! I didn’t. I have an interesting mix of system/local files now.

Add extensions as needed. Test ./configure each time, and you might as well re-build each time.

Decide where to get libraries. I finally decided to use darwinports for the non-Apple standards. Look out for X11 when not installed!!!!

Use the built-in GD ‘–with-gd’ - no path. darwinports gd has issues (won’t build).

I wound up with this

configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –with-apxs –with-ldap=/usr –with-kerberos=/usr –enable-cli –with-zlib-dir=/usr –enable-trans-sid –with-xml –enable-exif –enable-ftp –enable-mbstring –enable-mbregex –enable-dbx –enable-sockets –with-iodbc=/usr –with-curl=/opt/local –with-config-file-path=/etc –sysconfdir=/private/etc –with-pear –with-mysql=/usr/local/mysql –with-openssl=/usr –with-gd –with-png=/opt/local –with-jpeg=/opt/local –with-expat=/opt/local –with-gettext=/opt/local –with-dom=/opt/local –with-dom-xslt=/opt/local –with-xslt-sablot=/opt/local –enable-xslt –with-xmlrpc –enable-wddx

I still need to figure out about IMAP support.

AFP548 - my.cnf

What a difference a little conf file makes!So, we here at AFP548.com are by no means DBAs in any way shape or form. We cross our fingers every time we upgrade the server that MySQL works when it comes up. We’re not sure what we’d do if it didn’t.

I tried it. First impression is that dynamic pages on the blogs *are* faster.

/etc/httpd/sites_disabled/0000_default_default.conf

the location of the default settings for virtual hosts (VirtualHost) that are used by the ServerAdmin GUI interface.

Add or change things here to have newly added web sites get your favorite changes to the configuration.

httpd configuration default virtualhost

Apache configuration file

When creating Alias entries remember that they need to be listed in the order longest to shortest

Alias /foo/bar /path/bar
Alias /foo /path/other

compare that to Location which are ordered from shortest to longest

<Location /foo> <Location>
<Location /foo/bar> <Location>

phpMyAdmin 2.6.1-rc1
php 4.3.10

All seems well

Creating Secure Transactions on Mac OS X server Using SSL

As of version 10.3, Mac OS X Server provides built-in SSL encryption and authentication for POP, IMAP, SMTP, and LDAP, as well as for remote server management via servermgrd. The first step in getting SSL running on Mac OS X Server is to get a certificate.

This can be done in two ways: the official way, by getting an official CA to sign your key pair; or the unofficial way, by acting as your own CA. The latter method will raise errors on users’ systems until they accept your authority, so it is not ideal for transactions with the public, but it’s just fine for testing and internal company use, and it is free to generate as many as desired, whereas official certificates start in the hundreds of dollars

Simple Tricks for More Usable Forms [JavaScript & DHTML Tutorials]
You will certainly have encountered our first trick before; it’s used by Google, the world’s most popular search engine. Whenever you load up www.google.com, your cursor jumps straight to the search box, ready for you to enter your query. It happens so fast you may not even have thought about it, but, in fact, it works equally well in any situation in which the primary purpose of a page is to fill in a form. It can be done in a number of different ways, each of which assumes that the form element you want to focus on has an id attribute set to “myfield”:

<body onload=”document.getElementById(’myfield’).focus()”></body>

A tour of the PHP.INI configuration file, part 2
The first part of this article introduced you to the php.ini file, explained its structure, and showed you how to adjust PHP’s search path, error handling, and parser options. This second part goes deeper into the configuration file, covering topics such as how to activate PHP’s extensions, setting resource limits for your PHP scripts, and altering configuration variables on the fly through a PHP script.

Open Source Developer Technology Center

Bookmark this page for technical information about the use of open source tools and languages in conjunction with Oracle.

What’s New

The Hitchhiker’s Guide to PHP

Setting Up Oracle and PHP on Mac OS X

If you are a developer who works with Oracle applications and has been itching for an alternative to Windows or Linux—or if you are an experienced OS X user and are looking at basing your next project on Oracle—this article is for you. It assumes that you are comfortable working in the shell environment and have a working installation of OS X 10.3 (Panther) or 10.2 (Jaguar), including the developer tools and an administrator account.

Add the simple include line at the end of /etc/httpd/httpd.conf

Include /usr/local/php/httpd.conf.php

Started WebServer

Voila - after an upgrade Apache is happy, and MySQL was already started up.

XML.com: Transforming XML with PHP [Jun. 18, 2003]

Need PEAR, but that’s why we did the latest update from Marc Liyanage

I fiddled around with my access_log file for Apache. Specifically I removed all lines containing .jpg and .gif

What I didn’t do was restart Apache. I lost all of the log entries for the past week - pointing to a non-existent log file.

Web service still worked, just the log entries went to data heaven.

If you fool around with your Apache log files it is probably best to restart Apache when the modifying is done.

Warning: ftp_site(): Transfer completed. 23188 (8) bytes transferred. in /Library/WebServer/Include/IIWheader.inc on line 102 Error: Site command failed.

I think I’m experiencing a timeout on a long running query. I found a couple of references to commands to address this issue and tried them to no avail.

set_time_limit(6000);
$old_max_execution_time = ini_set(”max_execution_time”, 6000);
$fn = rdb_query($conn_block, $host, $db, $query);
ini_set(”max_execution_time”, $old_max_execution_time);

the fix

ftp_set_option($conn_id, FTP_TIMEOUT_SEC, $runtime);