Apache

Auto Update WordPress Without FTP

upgrade plugins without ftp credentials.

wp-config.php:
define('FS_METHOD','direct');

By WladyX on 27 August, 2010 | Apache, General, Wordpress | A comment?

Proxy internal site with Apaches’ Proxy module

reverse proxy

source

By WladyX on 14 April, 2010 | Apache, General, Security | A comment?

Awstats on Ubuntu

By WladyX on 24 March, 2010 | Apache, Mail, Ubuntu | A comment?

Setting Up Apache2 with SSL on Ubuntu Intrepid 8.10 using OpenSSL

By WladyX on 6 January, 2010 | Apache, General, Ubuntu | A comment?

Apache vhost SSL SNI

In the ssl virtual host fragment:

SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/ssl/apache2/wxs.crt
SSLCertificateKeyFile /etc/ssl/apache2/wxs.key
SSLCertificateChainFile /etc/ssl/apache2/sub.class1.server.ca.pem
SSLCACertificateFile /etc/ssl/apache2/ca.pem
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
SSLOptions StrictRequire
SSLProtocol all -SSLv2

This is for StartSSL.com certs.

By WladyX on 10 December, 2009 | Apache, General, Gentoo | A comment?

How To Specify A Custom php.ini For A Web Site (Apache2 With mod_php)

By WladyX on 4 February, 2009 | Apache, General | A comment?

ACL

Set default user for a folder:

setfacl -d -m user:apache:rwx wwwdir

By WladyX on 19 August, 2008 | Apache | A comment?

phpMyBackupPro bug

see

functions.inc.php file. Note the two “/2″ additions.

Change:

// set max string size before writing to file

if (@ini_get(“memory_limit”)) $max_size=900000*ini_get(“memory_limit”);

else $max_size=$PMBP_SYS_VAR['memory_limit'];

To:

// set max string size before writing to file

if (@ini_get(“memory_limit”)) $max_size=900000*ini_get(“memory_limit”)/2;

else $max_size=$PMBP_SYS_VAR['memory_limit']/2;

SourceForge.net: Detail: 1774361 – Memory Exhasted Bug Fix Suggestion

+

PHP Fatal error: Maximum execution time of 60 seconds exceeded in {phpMyBackupPro}\functions.inc.php [ phpMyBackupPro v2.1]

Solution: To increase the execution time of PHP, You can modify the {phpMyBackupPro}\global_conf.php

Original code

$CONF['timelimit']=”60″;

Modified code

$CONF['timelimit']=”600″;

http://errerrors.blogspot.com/2007/09/php-fatal-error-maximum-execution-time.html

By WladyX on 8 April, 2008 | Apache, General, Mysql | A comment?

WebDav

Mozilla Sunbird® is a cross-platform calendar application, built upon Mozilla Toolkit. Our goal is to bring Mozilla-style ease-of-use to your calendar, without tying you to a particular storage solution.Installing the Apache Server

To install the Apache Server, open up a Terminal (Applications > Accessories > Terminal)

sudo apt-get install apache2

Now, you have the option of changing the port your Apache Server runs on. By default it runs on port 80, which is fine if there is only one computer. But if you setup a router to forward all traffic for port 80 to one computer on your network the internet on your other computers will not work.

To change the port

sudo vi /etc/apache2/ports.conf

In the file add the following line, where “port” is whatever port you would like to use (e.g. Listen 9999) save and exit

Listen port

NOTE: Make sure to forward traffic on this port to your server if you have a router

Enabling the WebDAV modules

To enable the WebDAV modules, open up a Terminal (Applications > Accessories > Terminal)

sudo a2enmod

dav

(press enter)

sudo a2enmod

dav_fs

(press enter)

Setting up the WebDAV folder and the user

This will make a WebDAV folder at: /var/www/davhome

To create the folder, open up a Terminal (Applications > Accessories > Terminal)

mkdir /var/www/davhome

chgrp www-data /var/www/davhome

chmod 775 /var/www/davhome

Next to create the user, input the following command changing the last “username” part of the command to the username you would like to use (obviously make a note of the username and password you create)

htpasswd -c /var/www/davhome/.DAVlogin username

Tell Apache where the folder is and to use it

To tell Apache to use WebDAV, open up a Terminal (Applications > Accessories > Terminal)

sudo vi /etc/apache2/mods-enabled/dav_fs.conf

Paste the following into the file.Change “username” (two instances) to the username you created above. Also, the DAVMinTimeout is optional it just sets the how long Apache should lock the file after it is accessed.I don’t use it and haven’t had a problem, but then again I only have one computer accessing the calendar at any time.

DAVLockDB /tmp/DAVLock
#DAVMinTimeout 600

<Location /davhome/>
Dav On
AuthType Basic
AuthName username
AuthUserFile /var/www/davhome/.DAVlogin
<LimitExcept OPTIONS>
Require user username
</LimitExcept>
</Location>

Hopefully you didn’t exit and save yet because you have some more options. With the way the file is setup above you will be prompted for a username/password everytime you read or save a file using WebDAV.

If you don’t want to be asked a password when you read a file change the first LimitExcept line to

<LimitExcept GET OPTIONS>

If you don’t want to be asked a password when you save a file (write) change the first LimitExcept line to

<LimitExcept PUT OPTIONS>

If you don’t want to be asked a password when reading or writing (not recommended unless you want to make the calendar completely public) change the first LimitExcept line to

<LimitExcept GET PUT OPTIONS>

Okay, now you can save and exit.

Restart Apache

This step is very important so that Apache recognizes the changes you made!

Open up a Terminal (Applications > Accessories > Terminal)

sudo /etc/init.d/apache2 restart

Testing Your server

Now you can either create a new calendar in Sunbird and tell it to put it on your server or publish an existing local calendar to the WebDAV folder. Just go to the calendar tab in Sunbird and right-click in the list of calendars or right-click on an existing calendar in the list.

The address format you would enter for the remote calendar is as follows

http://server_ip_or_hostname:port_if_not_80/davhome/filename_for_calendar.ics

Other Items to Note

If you place an exisiting calendar file directly in /var/www/davhome, you should change the group and the rights on this file as follows

sudo chgrp www-data /var/www/davhome/filename_for_calendar.ics

sudo chmod 644 /var/www/davhome/filename_for_calendar.ics

If Sunbird does NOT create a new .ics file, do the following and point Sunbird to that file as if it is an existing calendar:

sudo touch /var/www/davhome/filename_for_calendar.ics

sudo chgrp www-data /var/www/davhome/filename_for_calendar.ics

sudo chmod 644 /var/www/davhome/filename_for_calendar.ics

 http://www.ubuntugeek.com/howto-setup-a-remote-calendar-using-webdav-with-mozilla-sunbird.html

Custom: enable the module and add a vhost:

<VirtualHost *:443>
<Directory “/media/storage/hosting/wxs.ro/dav/”>
Dav On
AuthType Basic
AuthName username
AuthUserFile /etc/apache2/davlogin
<LimitExcept OPTIONS>
Require user testx
</LimitExcept>

# AllowOverride AuthConfig
Order deny,allow
Deny from all
Allow from 85.182.94.97       # RP2
Allow from 193.232.246.33
Allow from 192.168.0.1
Allow from 127.0.0.1
</Directory>

ServerName syncdav.wxs.ro
DocumentRoot /media/storage/hosting/wxs.ro/dav/
DirectoryIndex index.php index.html
ErrorLog /var/log/apache2/syncdav.wxs.ro-error
CustomLog /var/log/apache2/syncdav.wxs.ro-access combined
</VirtualHost>

By WladyX on 7 April, 2008 | Apache | A comment?

Apache infos

# ServerTokens

# This directive configures what you return as the Server HTTP response

# Header. The default is ‘Full’ which sends information about the OS-Type

# and compiled in modules.

# Set to one of: Full | OS | Minor | Minimal | Major | Prod

# where Full conveys the most information, and Prod the least.

#

ServerTokens Full