![]() ![]() Mv /var/log/nginx/nginx-access.log /var/log/nginx/nginx-access_$DATE.log Mv /var/log/nginx/nginx-error.log /var/log/nginx/nginx-error_$DATE.log To rotate these logs regularly, create a script /usr/local/scripts/nginx-logrotate.sh. ![]() Verify that the site’s access log contains your hits. Verify the site comes up, and that nginx is actually serving your content. To test the basic site, make an /etc/hosts entry on your desktop pointing the site to the new IP address, like so:ġ39.171.202.40 You desktop Web browser should use /etc/hosts over the DNS entry for that host, letting you call up the test site in your Web browser. nginx doesn’t need ServerAlias entries just list multiple server names. I don’t need to worry about the referral spam log, as I cannot separate it out. That brings up the basic site and its logs. Server_name access_log /var/log/bh/bh-access.log In the http section of the configuration file, I tell nginx where to put the main server logs.Įrror_log /var/log/nginx/nginx-error.log Īccess_log /var/log/nginx/nginx-access.log ĭefine a virtual server and include the log statements: nginx doesn’t have this functionality I must rotate my logs with an external script. In Apache, I achieve this with rotatelogs(8), a program shipped with Apache. I rotate my web logs daily, and retain them indefinitely, in a file named by date. The first thing I need to change is the nginx error log. Various web-server-wide settings log formats, include files, etc. General nginx settings: pid file, user, etc. usr/local/etc/nginx/nf is a sparse, C-style hierarchical configuration file. ScriptAlias /awstats/ "/usr/local/www/awstats/cgi-bin/" ServerAlias ErrorDocument 404 /index.htmlĮrrorLog "|/usr/local/sbin/rotatelogs /var/log/bh/bh_error_log.%Y-%m-%d-%H_%M_%S 86400 -300"ĬustomLog "|/usr/local/sbin/rotatelogs /var/log/bh/bh_spam_log.%Y-%m-%d-%H_%M_%S 86400 -300" combined env=spamĬustomLog "|/usr/local/sbin/rotatelogs /var/log/bh/bh_access_log.%Y-%m-%d-%H_%M_%S 86400 -300" combined env=!spamĪlias /awstatclasses "/usr/local/www/awstats/classes/"Īlias /awstatscss "/usr/local/www/awstats/css/"Īlias /awstatsicons "/usr/local/www/awstats/icons/" Here’s the Apache 2.2 configuration for it. (I’ll cover the WordPress parts in later posts.) I expect to get all of the functionality out of nginx that I have on Apache.įor many years, was my main Web site. To start, I’m moving my static Web sites to the new server. I’ll have to find another way to deal with referrer spam, but at least the site will be up more consistently. Also, nginx doesn’t support anything like the mod_security application firewall. Awstats io password#htaccess for password protection I must put my password protection rules directly in the nginx configuration. Look for the Apache modules you use, and see if they have an nginx equivalent. According to the documentations I’ve dug up, it should all Just Work.īefore making this kind of switch, check the nginx module comparison page. The new server runs FreeBSD 9/i386 running on VMWare ESXi. WordPress seems to be the best of the available evils - er, Web site design tools. I’d like to switch to Postgres as well, but WordPress’s official release doesn’t yet support Postgres. Apache, with all its modules, has a lot of moving parts.Īfter six months of intermittent debugging, I decided that with the new hardware I would switch Web server software, and settled on nginx. The more moving parts something has, the harder it is to debug. I must log in, kill Apache, and restart it. Every so often, Apache devours all available memory and the server becomes very very slow. My more complex Web sites run atop WordPress on Apache and MySQL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |