Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Wednesday, October 2, 2013

Change Group Owner For /var/www

Taking another note. Here's how to change group owner for /var/www directory in Ubuntu Server 12.04. By default that directory meant to be DocumentRoot for Apache 2 web server and own by root. This practice is useful if we want to share the access to several people in webmaster group.


sudo addgroup webmasters

sudo chgrp -R webmasters /var/www

sudo find /var/www -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www -type f -exec chmod g=rws "{}" \;

sudo gpasswd --add user webmasters
sudo gpasswd --add colleague1 webmasters
sudo gpasswd --add colleague2 webmasters
# etc.

Tuesday, April 12, 2011

Apache MySQL PHP on Mac OS X Snow Leopard

In Mac OS X, you already have built-in Apache web server and you only need to activate it by going to System Preferences -> Sharing -> then check the "Web Sharing". That's it! And you already have your web server running. Just check it by typing "http://localhost" or "http://localhost/~yourusername" in your web browser.

PHP
After that, you can open Terminal and open /private/etc/apache2/httpd.conf file and uncomment this line:
LoadModule php5_module           libexec/apache2/libphp5.so
 then restart Apache service by uncheck - recheck Web Sharing in System Preferences

MySQL
1. Download package from here
2. Install everything: mysql, startup item, preference pane
3. Start MySQL in Preference Pane

Do the following to fix some stuffs:
$ cd /etc
$ sudo cp php.ini.default php.ini
$ sudo chmod 666 php.ini
In php.ini file, edit following:
1. uncomment this line and insert TimeZone:
date.timezone =Asia/Jakarta
2. find all three occurences of /var/mysql/mysql.sock and change to /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
3. change this line from "Off" to "On"
short_open_tag = On
Restart Apache service by uncheck - recheck Web Sharing in System Preferences

Thursday, July 22, 2010

OpenFire Server for Broadcast IM

These are some screenshoot of my OpenFire server configuration, I use this as an integrated service to communicate with all of my colleagues in my department. This way, we can share any update information in a more efficient and simple way :)





Wednesday, May 26, 2010

MySQL Load Problem Workaround on Ubuntu Server

Although I could say that using Ubuntu Server is easy, but apparently not all the setting-up things run well :)) Recently I've got problem with my MySQL Load. My web pages cannot connect to MySQL Server, but checking to connect from terminal don't have trouble at all.

After doing some googling, mine is working now. It seems that mysql 5.0 needs php5-mysqli rather than php5-mysql. Basically it involved editing the 'extension_dir' property in my php.ini file:
$ sudo vi /etc/php5/apache2/php.ini
for the 'extension_dir' property change /usr/lib/php5/20060613 to '/usr/lib/php5/ext' and save the file.

Now you have to create the directory:
$ sudo mkdir /usr/lib/php5/ext

And now copy your mysql.so file to this new directory under the new name mysqli.so:
$ sudo cp /usr/lib/php5/20060613/mysql.so /usr/lib/php5/ext/mysqli.so

Then restart Apache:
$ sudo /usr/sbin/apache2ctl restart

Monday, May 24, 2010

cPanel Configuration for MySQL Access

Case: cPanel user would like to hire web developer, want to give ftp access (for upload and download web files) and MySQL database access (the web is using Joomla) only.

These are the example:
- db name: cybi1_testing
- db username: cybi1_test
- pass: t3st1ng
- host: cybi.co.id (server Cohosting 1)

a. via terminal:



b. or via phpMyAdmin (available for Linux/ Unix, Windows and Mac/ other mySQL FrontEnd GUI:




Below are the steps to follow:
1. Create ftp account for the web developer, menu Files → FTP Accounts



Fill-in username, password, default directory dan capacity




2. Create new database, user and priviliges to access the database







3. Allowing host to access database, Databases → Remote MySQL




Enjoy.. :)

Thursday, April 15, 2010

Building Cacti on Ubuntu Server 8.04 Hardy Heron



Although it seems difficult, after several trial and error on my Ubuntu Server 8.04 finally I can get my Cacti up and running :) I copy-paste from Cacti website installation document and editing several lines to suite Ubuntu. First of all, you need to install from repositories (including all dependencies):
- apache2
- php5
- php5-cli
- rrdtool
- snmp
- cacti sourse file from here, choose the latest version

Configure PHP
Please find the file /etc/php5/apache2/php.ini and make the following changes to it:
extension_dir = /etc/php.d
This will enable PHP to find more configuration directives in that very directory.


If you want to allow template importing, uncomment the following line:

file_uploads = On
 Activate the MySQL extension via /etc/php5/conf.d/mysql.ini
; Enable mysql extension module
extension=mysql.so
Activate the SNMP extension via /etc/php5/conf.d/mysql.ini
; Enable snmp extension module
extension=snmp.so

Configure the Webserver (Apache)
Please locate the PHP configuration file at /etc/apache2/httpd.conf
If using PHP 5, then add the following lines.
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
DirectoryIndex index.php
Configure MySQL
Set a password for the root user
# mysqladmin --user=root password somepassword
# mysqladmin --user=root --password reload

Install and Configure Cacti
1. Extract the distribution tarball
# tar xzvf cacti-version.tar.gz

2. Create the MySQL database:
# mysqladmin --user=root create cacti

3. Import the default cacti database:

# mysql cacti < /path/to/cacti/cacti.sql

4. Optional: Create a MySQL username and password for Cacti.
# mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

Edit /path/to/cacti/include/config.php and specify the database type, name, host, user and password for your Cacti configuration.
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";

Set the appropriate permissions on cacti's directories for graph/log generation. You should execute these commands from inside cacti's directory to change the permissions.
# chown -R cactiuser rra/ log/

(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering)

Point your web browser to:

http://your-server/cacti/

Log in the with a username/password of admin
. You will be required to change this password immediately. Make sure to fill in all of the path variables carefully and correctly on the following screen.

For Ubuntu Distro, I have found that crontab setting is a bit different. You must edit /etc/cron.d/cacti files in order the cron to be running (Usually we used crontab -e in any linux/unix to add cron job)

$ cat /etc/cron.d/cacti
MAILTO=
*/5 * * * * root php /var/www/cacti/poller.php > /dev/null 2>&1 /var/log/cacti/poller-error.log