Apaches
Contents |
Restarting
All
Connect to zwinger and type apache-graceful-all. If you see permission denied or a password request, say which server name appears in the error message or password request in the IRC channel and one of the roots will add you to that server.
One, to test a change
Either connect to zwinger and ssh wherever or connect to the web server you want to test on. Then type apache-graceful to restart apache on that web server only. Test your change with telnet, as with this foundation example, with what you type in italics:
telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /fundraising HTTP/1.1
Host:wikimediafoundation.org
(an empty line)
The raw HTML for the page will now be displayed in your window. You can copy and paste that into a file on your hard drive and open it with your browser to see the effect. Host is the name of the web site after the http:// part in your browser URL area. GET /fundraising is the part after the site name. The example gets http://wikimediafoundation.org/fundraising.
Restarting httpd
If httpd is broken, sudo apache-restart to restart a single httpd. Use dsh to apply it to all. If you get hundreds of instances counted by ps aux|grep httpd|wc -l and the server is having problems you might need to do this.
Starting load-balancing ICPAgent
This is started automatically when the computer restarts and is necessary for the Apache to take any work. To start:
- use /usr/local/bin/icpagent, has the right timings for each host
Stopping load-balancing ICPAgent
If you need to take the load from this Apache use either:
- killall icpagent as root
- remote management? as a member of group wikidev
Logging
Text output on stderr from various external commands, as well as some apache errors, are in /apache/logs/error_log on each server. PHP errors are in /apache/logs/php-errors . Most apache error messages, such as file not found errors, are in hostname-error_log, for example /apache/logs/en.wikipedia.org-error_log .
Apache access logs are mostly disabled. Webalizer statistics are made using the squids logs instead.
Apache setup checklist
- From the bastion host, run: cd /home/wikipedia/src/packages && ./bootstrap <HOSTNAME> setup-apache. This will set up SSH host keys and NFS mounts and install NTP, LDAP, Apache, PHP, MW and lots of other good stuff. It sets up the sysctls and IP addresses for LVS use, and starts apache. Thus it gets a host from the state Kyle typically leaves it in after a reinstall, to an apache actually in the pool, in one simple command. It is rerunnable, so if anything goes wrong, just edit the script and run it again. The only other thing left to do is to update the various host lists.
- Add the host to /usr/local/dsh/node_groups/apaches and mediawiki-installation
- scp /usr/local/dsh/node_groups/apaches root@dalembert:/usr/local/etc/
- ssh root@dalembert ; screen -r ; break lvsmon and start it again
- cd /home/wikipedia/conf/nagios && ./sync
download.wikimedia.org etc
- currently on zwinger
Test cases
Here are some test cases you can use to test the apache configuration after changing something.
GET /wiki/Foo HTTP/1.1 Host: en.wikipedia.org GET /wiki/Foo HTTP/1.1 Host: www.wikipedia.org GET / HTTP/1.1 Host: en2.wikipedia.org GET /wiki/Main_Page HTTP/1.1 Host: www.wikipedia.com GET / HTTP/1.1 Host: wikipedia.com GET / HTTP/1.1 Host: wikibooks.org GET / HTTP/1.1 Host: wikiquote.org GET / HTTP/1.1 Host: dk.wikipedia.org GET / HTTP/1.1 Host: foo.wikipedia.org GET /wiki/Main_Page HTTP/1.1 Host: test.wikipedia.org GET / HTTP/1.1 Host: webshop.wikipedia.org GET / HTTP/1.1 Host: boards.wikimedia.org GET /wiki/Foo HTTP/1.1 Host: en.wikipedia.org User-Agent: Exalead GET /wiki/Foo HTTP/1.1 Host: meta.wikimedia.org GET / HTTP/1.1 Host: en.wiktionary.org