Rsync is often used for backup systems, with options such as:

-A --acls       : preserve the ACL, if used

-X --xattrs     : preserve extended attributes, if used

-H --hard-links : detect and preserve hard links

-a --archive    : resources and preserve the usual attributes: symbolic links, devices and special files,
user and group ownership, permissions and schedules

In addition to these stock options, rsync has many other.

Each has its own recipe, but I’d like to share two useful features :

Continue Reading…

If users have access to the files on your server, but you don’t want they to be able to execute commands, you can limit access to  sftp only.

Add a user to your system as normal with a password and then run the following command:

usermod -s /usr/lib/sftp-server username

Then change add the following to /etc/shells to make it a valid shell:

echo '/usr/lib/sftp-server' >> /etc/shells

Now this user can only run the sftp server as shell

 

Enjoy

For the sake of SEO is better to have one URL for each post or article on your site, like having two uris respond with the same content can lead to duplicate content and is penalized by search engines, especially Google, which is the largest by far.

Therefore, if you’re using Nginx and want to remove the trailing slash at the end of every URI in your site.

So if someone writes:

http://yoursite.com/ will be automatically redirected to http://yoursite.com

Here is the code needed to put it in your nginx.conf.

rewrite ^/(.*)/$ /$1 permanent;

That goes in the server section so something like this:

server {
listen  :80;
server_name  www.yoursite.com;
rewrite ^/(.*)/$ /$1 permanent;
}

Nginx will handle the trailing slashes now.

1. Configure The Master
First we have to edit /etc/mysql/my.cnf

We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):

#skip-networking
#bind-address            = 127.0.0.1

Furthermorewe have to tell MySQL for which database it should write logs,which log file it should use, and we have to specify that this MySQLserver is the master. We want to replicate the database exampledb, so we put the following lines into /etc/mysql/my.cnf:

log-bin = /var/log/mysql/mysql-bin.log

# what database you want to replication

binlog-do-db=exampledb

server-id=1

Then we restart MySQL:

/etc/init.d/mysql restart

Then we log into the MySQL database as root and create a user with replication privileges:

mysql -u root -p
Enter password:

GRANT REPLICATION SLAVE ON *.* TO ‘slave_user’@’%’ IDENTIFIED BY ‘<your_password>’;
FLUSH PRIVILEGES;

Next do this:

USE exampledb; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS;

Now leave the MySQL shell:

Continue Reading…

You may be concerned about the security of your servers, and you should know that hackers often try to break your server

One way to secure your LAMP server would stop Apache and PHP5 to send details of their versions or other valuable informations.

1. How to hide Apache2 version?

Continue Reading…

Page 23 of 44« First...10...19202122232425262728...40...Last »