add apache to users group
// puts apache into the users group to allow dev teams etc..
sed -i 's/users:x:1000:admin/users:x:1000:admin,wwwrun/' /etc/group
2798 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
sed -i 's/users:x:1000:admin/users:x:1000:admin,wwwrun/' /etc/group
<IfModule mod_rewrite.c> RewriteRule ^(.*/)?\.svn/ - [F,L] ErrorDocument 403 "Access Forbidden" </IfModule>
<DirectoryMatch "^/.*/(\.svn|CVS)/"> Order deny,allow Deny from all </DirectoryMatch>
sudo apt-get install apache2 mysql-server php5 php5-odbc libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql libmyodbc
[ODBC Data Sources] odbcname = MyODBC 3.51 Driver DSN [odbcname] Driver = /usr/lib/odbc/libmyodbc.so Description = MyODBC 3.51 Driver DSN SERVER = my.database.server.com PORT = USER = USER Password = XXXXXX Database = DBNAME OPTION = 3 SOCKET = [Default] Driver = /usr/local/lib/libmyodbc3.so Description = MyODBC 3.51 Driver DSN SERVER = localhost PORT = USER = root Password = Database = test OPTION = 3 SOCKET =
sudo /etc/init.d/mysql start sudo /etc/init.d/apache2 start sudo /etc/init.d/mysql stop sudo /etc/init.d/apache2 stop sudo /etc/init.d/mysql restart sudo /etc/init.d/apache2 restart
sudo mv /usr/sbin/httpd /usr/sbin/httpd.ub sudo lipo -thin ppc7400 /usr/sbin/httpd.ub -output /usr/sbin/httpd.ppc7400 sudo ln -s /usr/sbin/httpd.ppc7400 /usr/sbin/httpd
sudo mv /usr/sbin/httpd.ub /usr/sbin/httpd
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L]
# redirect all visitors to alternate site but retain full access for you ErrorDocument 403 http://www.alternate-site.com Order deny,allow Deny from all Allow from 99.88.77.66
#!/usr/bin/perl #This is .latest.cgi $|++; my @file = `ls -1 -t -p | grep -v -P '/'`; print "Location: $file[0]\n\n"; exit;
apachectl -t
apachectl graceful
apachectl restart
<IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
#Force SSL RewriteCond %{SERVER_PORT} !443 RewriteRule ^(.*)$ https://securesiteurl.com/$1 [R=301,L]
AddType application/x-httpd-php .htm .php
RewriteEngine On RewriteCond %{HTTP_HOST} ^domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
Options +Indexes IndexOptions FancyIndexing NameWidth=*
<VirtualHost *:80> ServerName test.com DirectoryIndex index.html dispatch.fcgi DocumentRoot /domains/test.com/web/public RewriteEngine On RewriteRule ^(.*/)?.svn/ - [F,L] ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! ProxyPass /examples ! ProxyPass /map_data ! ProxyPass /engine_files ! ProxyPass /javascript ! ProxyPass /feregions ! ProxyPass / balancer://test/ ProxyPassReverse / balancer://test ProxyPreserveHost On ErrorLog /opt/csw/apache2/var/log/test.com.error CustomLog /opt/csw/apache2/var/log/test.com common <Proxy balancer://test> BalancerMember http://127.0.0.1:8000 BalancerMember http://127.0.0.1:8001 BalancerMember http://127.0.0.1:8002 BalancerMember http://127.0.0.1:8003 BalancerMember http://127.0.0.1:8004 </Proxy> </VirtualHost>
# setting up apache2 + SSL on FreeBSD # a list of commands you can copy/paste! # @author Jamie Wilkinson <[email protected]> # ganked from <http://www.freebsdmadeeasy.com/tutorials/web-server/apache-ssl-certs.php> # edit /etc/openssl.conf to set some nice defaults for location, org. name, etc. # important! change the default dir ./demoCA to /root/sslCA # setup cd ~root/ mkdir sslCA chmod 700 sslCA cd sslCA mkdir certs private newcerts echo 1000 > serial touch index.txt # generate certs openssl req -new -nodes -out eyebeam-req.pem -keyout private/eyebeam-key.pem -config /etc/ssl/openssl.cnf openssl req -new -x509 -days 3650 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -config /etc/ssl/openssl.cnf openssl ca -config /etc/ssl/openssl.cnf -out eyebeam-cert.pem -days 3650 -infiles eyebeam-req.pem # keep them somewhere handy mkdir /etc/ssl/crt mkdir /etc/ssl/key cp ~root/sslCA/eyebeam-cert.pem /etc/ssl/crt cp ~root/sslCA/private/eyebeam-key.pem /etc/ssl/key # add below to an ssl.conf that you include in your httpd.conf <VirtualHost *:443> ServerName colossus.eyebeam.org:443 SSLEngine on SSLCertificateFile /etc/ssl/crt/eyebeam-cert.pem SSLCertificateKeyFile /etc/ssl/key/eyebeam-key.pem DocumentRoot /www CustomLog /var/log/httpd-ssl-access.log combined ErrorLog /var/log/httpd-ssl-error.log </VirtualHost>
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+)$ RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteEngine On RewriteBase /the_directory RewriteRule ^(.*).html$ $1.php [R=301]
#!/bin/sh /usr/bin/grep CustomLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log > logfiles /usr/bin/grep ErrorLog /usr/local/etc/apache2/httpd.conf |/usr/bin/grep -v \#|/usr/bin/awk '{print $2}'|/usr/bin/sort|/usr/bin/uniq|/usr/bin/grep -v /var/log >> logfiles /usr/local/bin/weblog_rotate.pl --loglist logfiles --touchlog --restart_cmd "/usr/local/etc/rc.d/apache2.sh restart" --compress --days 120
AddHandler fcgid-script .php <Directory /home/elitesys/elite-systems.org/html> FCGIWrapper /home/elitesys/elite-systems.org/html/php.fcgi .php </Directory> IPCConnectTimeout 20 IPCCommTimeout 300
#!/bin/sh PHPRC="/usr/php4/etc" export PHPRC PHP_FCGI_CHILDREN=4 export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_MAX_REQUESTS exec /usr/php4/bin/php