Separating machines between WebServer and the code server is kind of easy.
Basic knowledges you have to know is about httpd.conf, networkfilesystem, fstab, and user-group id
NetworkFileSystem is the one we will use to share the directory from the code server.
First : See your httpd.conf files for each VirtualHost directives, you will find DocumentRoot for each VirtualHosts.
These VirtualHosts are all the domains/hosts absolute path on unix style.
example :
<VirtualHost *:80>
ServerAdmin admin@domainnameyahoo.info
DocumentRoot /var/www/html/domannameyahoo.info
ServerName domainnameyahoo.info
ServerAlias www.domainnameyahoo.info
ErrorLog /var/log/httpd/domainnameyahoo.info-error_log
CustomLog /var/log/httpd/domainnameyahoo.info-access_log common
DirectoryIndex default.php index.php index.html
</VirtualHost>
Next, make sure you have php/html code in your code server.
Then start to mount the code server as follow :
# mount -t nfs -o rw 192.168.1.10:/var/www/html/domainnameyahoo.info /var/www/html/domainnameyahoo.info
note : 192.168.1.10 is your code_server ip address
June 18th, 2009
Posted by
admin |
Apache, CentOS, Ubuntu |
no comments
Generally, people put together between the WebServer (httpd services) with php code.
For economic sakes , yes you may put it that way. No other choice.
But for easy maintenance and more security better you put WebServer and php code in separated machine even the Database server is also separated.
With this way you can create Web Server load balancing, or any backup Web Server.
Things you have to know is around linux file sharing ( i am going to use nfs as file sharing ) and some security on firewall to keep the code and database more secure.
This time, I put 1 little machine which will act as webserver.
I will tell you all the step by step about it.
June 4th, 2009
Posted by
admin |
Apache, CentOS, General, Ubuntu |
no comments
Yes date&time must be setup correctly, otherwise your cron job will blow your head off.
Before you change the date you must pay attention to your timezone.
Simply execute # timeconfig from the shell.
Timeconfig not working ? It must be installed first.
# yum install timeconfig
Here is some common use to set the date and time of your box
#date –set=”1 JUN 2009 12:28:00″
That will change your Date and time with the correct format and time zone.
June 1st, 2009
Posted by
admin |
CentOS, General, Ubuntu |
no comments
Strange huh, why should I write about ifconfig syntax.
Yes, it is weird. But I guess, not all people know how to set up ip, gateway and dns manually.
- ifconfig
Display current configuration for all NIC’s.
- ifconfig eth0
Display current configuration for eth0.
- ifconfig eth0 192.168.1.2
Assign IP address 192.168.1.2 to eth0.
- ifconfig eth0:0 192.168.1.2
Assign multiple IP’s to eth0.
- ifconfig eth0:1 192.168.1.3
Assign second IP address to eth0:1
- route add default gw 192.168.1.1
Assign default gateway.
- ifconfig eth0 192.168.1.2 netmask 255.255.255.0
Assign IP/Subnet to eth0.
- route / route -n
View current routing table.
- traceroute www.domainnameyahoo.info
Trace network route from desktop to www.domainnameyahoo.info
- tracepath www.domainnameyahoo.info
Trace network path from desktop to www.domainnameyahoo.info
- host www.domainnameyahoo.info
DNS test using www.domainnameyahoo.info
- host 209.250.240.98
Reverse host lookup by IP address.
- dig -x 209.250.240.98
Advanced reverse DNS lookup by IP address.
Don’t forget to add the syntax in rc.local if you use multiple ipadrress.
May 27th, 2009
Posted by
admin |
CentOS, General, Ubuntu |
no comments
Yes, you can use rsync as your backup system over the network.
Here is my real problem on site:
- The box must not restart, shutdown or any downtime.
- The firewall has configured with only couple of port opened ( SSH, ftp ) these port has been changed into un-usual port. ( lets say 30022 as SSH, and 30021 as ftp ).
- I want to do all backup process automatically.
and Here’s my preparation.
- I have another box connected to internet with the same port opened. I dont want to have the usual port for SSH and FTP, hacker always try to hijack these port.
- Another media or harddrive must be prepared.
Here is the steps
First.
Make sure client-server are connected each other using ssh port (30022).
The idea is the server will connect to client using rsync with 30022 port. So, there will be no rsync daemon installed on server.
The basic syntax I am going to use is
rsync -av –progress –inplace –rsh=’ssh -p30022′ /etc root@client_ip:somedir/
lets try to run that syntax first, dont forget to change client_ip .
Run it on Server shell. And you will be prompted for client root’s password.
Last line of the result is :
etc/yum/yum-updatesd.conf
490 100% 0.84kB/s 0:00:00 (xfer#1990, to-check=2/3375)
etc/yum/pluginconf.d/
etc/yum/pluginconf.d/installonlyn.conf
84 100% 0.14kB/s 0:00:00 (xfer#1991, to-check=0/3375)
sent 108993486 bytes received 42267 bytes 31153072.29 bytes/sec
total size is 108818539 speedup is 1.00
When I see in ~root/somedir there are complete files of /etc directory from server.
Execute once again the same above syntax will not result anything like before, that mean the directory has been synced.
What do you think ? Not bad huh ?
You can repeat this step for another directory / from the server.
Another challange here is , ” Can I do this on Crontab schedule ?”.
As you can see above, you must enter root’s password, and this cannot be done by crontab.
…. to be continued..
April 29th, 2009
Posted by
admin |
CentOS, General, Ubuntu, backup |
no comments