Remove ping Reply From Ubuntu Server
A simple one liner to remove ping reply from Ubuntu server.
Open terminal and just issue the following command:
1 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all |
That’s it!
A simple one liner to remove ping reply from Ubuntu server.
Open terminal and just issue the following command:
1 | echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all |
That’s it!
After upgrading from Plesk 11 to 12, its possible to get a 404 page not found error the first time you try to visit the admin panel of Plesk.
A server reconfiguration will give you this warning:
1 | nginx: [warn] conflicting server name "" on 0.0.0.0:8443, ignored |
And the problem will remain.
A quick fix is to visit directly the address that apache listens and enter to the CP panel without SSL.
But to permanently fix this error you can do the following:
1 2 3 | rm /etc/sw-cp-server/conf.d/agent.conf service sw-cp-server stop service sw-cp-server start |
Error fixed!
Since Amazon offers its Amazon Linux AMI for free if used with a micro instance, it is a nice idea to use such a micro instance as a reverse proxy front-end for your actual web server. This setup offers many advantages, with enhanced security and fail over capabilities being two of them.
You have to select an Amazon Linux AMI to run as a micro instance. Store the Key Pair in order to be able to login to the machine and associate an elastic IP to it. Then alter the default security group opening port 80 and 443 to the world and 22 to the IP / IPs you will use to connect via ssh to the machine.
By default you can login to the machine via ssh using as user name “ec2-user” and the Key Pair that you downloaded upon AMI creation. In order to continue the installation it is convenient to became root. Type
1 | sudo su |
1 | yum update |
1 2 3 | yum install pcre-devel zlib-devel openssl-devel yum install gcc yum install make |
1 | wget http://nginx.org/download/nginx-1.1.0.tar.gz |
1 | tar xzf nginx-1.1.0.tar.gz |
1 2 3 4 | cd nginx-1.1.0 ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module make make install<span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; white-space: normal;"> </span> |
1 | /usr/local/sbin/nginx |
Navigate to your AMI’ s IP address and check if nginx responds showing it’ s default web page.
1 | nano /etc/init.d/nginx |
Copy the following code to the newly created file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #!/bin/sh # # processname: nginx # config: /usr/local/nginx/conf/nginx.conf # pidfile: /usr/local/nginx/logs/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/local/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" lockfile=/var/lock/subsys/nginx start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac |
Make the file executable.
1 | chmod 755 /etc/init.d/nginx |
Test.
1 2 3 | /etc/init.d/nginx stop /etc/init.d/nginx start /etc/init.d/nginx reload |
Finally, make the service start automatically at every reboot.
1 | /sbin/chkconfig nginx on |
Now you can configure your newly installed server.
You already have a working site with tons of content and good search engine rankings. What if you need to change your domain name or change the URL base of the site? That would mean that you will loose all current rankings and practically start over building your search engine rank. This would be the case, par example, if you have a forum residing to the path www.yourdomain.com/forum and you want to move your forum to to the root of your domain www.yourdomain.com.
Fear not, you can do this and keep all current search engine rankings using a “301” redirect. “301” redirect is the most efficient and search engine friendly method for webpage redirection. The code “301” is interpreted as “moved permanently” informing the Internet that the original web address has moved permanently to a stated new web address.
Many ways exist to implement a “301” redirect and the choice of the best one depends greatly on the programming language one is familiar with and the exact case that the redirection is needed. I prefer two ways, using PHP or an .htaccess file, depending on the case.
Just put an index.php file to the root directory of your old domain containing the following :
1 2 3 4 5 6 | <!--? header( "HTTP/1.1 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); header( "Location: http://www.yournewdomain.com" ); exit(0); // This is suggested to avoid any accidental output ?--> |
This method will also work if you haven’ t moved your site to another domain but just changed the URL base of your site.