i'm chris

I fall in love with you even though there will be no result !

Login
RSS Feed

Catch the Star That Will Take You to Your Dreams

Catch the star that holds your destiny, the one that forever twinkles within your heart. Take advantage of precious opportunities while they still sparkle before you. Always believe that your ultimate goal is attainable as long as you commit yourself to it.
Though barriers may sometimes stand in the way of your dreams, remember that your destiny is hiding behind them. Accept the fact that not everyone is going to approve of the choices you’ve made, have faith in your judgment, catch the star that twinkles in your heart, and it will lead you to your destiny’s path. Follow that pathway and uncover the sweet sunrises that await you.
Take pride in your accomplishments, as they are stepping stones to your dreams. Understand that you may make mistakes, but don’t let them discourage you. Value your capabilities and talents for they are what make you truly unique. The greatest gifts in life are not purchased, but acquired through hard work and determination.
Find the star that twinkles in your heart for you alone are capable of making your brightest dreams come true. Give your hopes everything you’ve got and you will catch the star that holds your destiny.

Nginx Block And Deny IP Address OR Network Subnets

How do I block or deny access based on the host name or IP address of the client visiting website under nginx web server?

Nginx comes with a simple module called ngx_http_access_module to allow or deny access to IP address. The syntax is as follows:

deny IP;
deny subnet;
allow IP;
allow subnet;
# block all ips
deny    all;
# allow all ips
allow    all;

Note rules are checked in the order of their record to the first match.

How Do I Configure Nginx To Block IPs?

Edit nginx.conf file, enter (note my nginx path is set to /usr/local/nginx/, replace this according to your setup):
# cd /usr/local/nginx/conf/
# vi nginx.conf

Add the following line in http section:

## Block spammers and other unwanted visitors  ##
 include blockips.conf;

Save and close the file. Finally, create blockips.conf in /usr/local/nginx/conf/, enter:
# vi blockips.conf
Append / add entries as follows:

deny 1.2.3.4;
deny 91.212.45.0/24;
deny 91.212.65.0/24;

Save and close the file. Test the config file, enter:
# /usr/local/nginx/sbin/nginx -t
Sample outputs:

the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful

Reload the new config, enter:
# /usr/local/nginx/sbin/nginx -s reload

How Do I Deny All and Allow Only Intranet/LAN IPs?

Edit config file as follows:

location / {
  # block one workstation
  deny    192.168.1.1;
  # allow anyone in 192.168.1.0/24
  allow   192.168.1.0/24;
  # drop rest of the world
  deny    all;
}

Granted access to network 192.168.1.0/24 with the exception of the address 192.168.1.1.

How Do I Customize HTTP 403 Forbidden Error Messages?

Create a file called error403.html in default document root, enter:
# cd /usr/local/nginx/html
# vi error403.html

<html>
<head><title>Error 403 - IP Address Blocked</title></head>
<body>
Your IP Address is blocked. If you this an error, please contact webmaster with your IP at webmaster@example.com
</body>
</html>

If SSI enabled, you can display the client IP easily from the html page itself:

Your IP Address is <!--#echo var="REMOTE_ADDR" --> blocked.

Save and close the file. Edit your nginx.conf file, enter:
# vi nginx.conf

# redirect server error pages to the static page
 error_page   403  /error403.html;
 location = /error403.html {
         root   html;
 }

Save and close the file. Reload nginx, enter:
# /usr/local/nginx/sbin/nginx -s reload

the 2nd five-week plan

Today is the first day of my second five-week plan. In a bad temper, because of the work. ?Too many things to do , i’m exhausted. In the office, the relations between staff are so complex. Talked with my roommate, he told me all I have to do is what I should do. He may be right, I have my own plan,ideal,goal ?and my own way of dealing ?with things. Don’t be influenced by others.

To summarize my first five-week plan,

1) I watched 70% of the video tutorial

2) Read a book,郎咸平《我们的日子为什么这么难》

Ok, now let’s talk about my second five-week plan:

1) I’ll keep learning thinkphp, and use it to actual project.

2) Read one book,白岩松《幸福了吗?》

HOLD ON ! AND BE HAPPY!

my five-week plan

As you may heard about the?Five-Year Plans of?China, now i have made my Five-Week Plans, lol. I’ve learned nothing of computer technology for a very long time, no technology no money, i do want to earn more money.

My first five-week plan has began on 2010.11.01. At first, i wanted to learn flex in this plan period, but there is a new project to do , my company wants to build a system which users can make an appointment to the doctor. This is ?complicated, and needs 3 person to develop it. To built this system rapidly, we chose the “thinkphp” framework, it’s a fast, compatible and simple oop mvc php framework. So in the least time of this plan period, i’ll learn “thinkphp”.

So, work hard & good luck!

Install Apache MySQL, PHP and phpmyadmin on Ubuntu10.10

Step 1: You start by installing mysql

sudo apt-get install mysql-client mysql-server

Specify new password for the MySQl “root” user when prompted. Repeat it for a second time and you would have MySQL server and client installed.

Step 2: Next,?install Apache2:

sudo apt-get install apache2

And you get apache2 installed as well. To double check, point your browser to http://localhost, and you should see the Apache2 placeholder page says “it works”.

Step 3: To install support for PHP, do the usual

sudo apt-get install php5 libapache2-mod-php5

To verify that everything installed correctly and php support is enabled, you need torestart apache by doing this

sudo /etc/init.d/apache2 restart

Create a test php file called?info.php, using a text editor of your choice (say gedit)

sudo gedit /var/www/info.php

and paste the following content and save the file

<?php phpinfo(); ?>

Now open the following page http://localhost/info.php and you should see the page like this.

Step 4: To make MySQL, php and apache talk among themselves, you would have to install php5-mysql, below I am listing some more useful packages that you might want to install

sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-common

Now refresh the info.php page that you have open in your browser and you should be able to see the support for mysql if you search for it by doing Ctrl+f, but before that don’t forget to restart apache again (sudo /etc/init.d/apache2 restart)

Step 5: Finally install phpmyadmin

sudo apt-get install phpmyadmin

It would ask if you want to configure it automatically for apache or lightppd choose apache (by pressing “spacebar” to display a star as shown below and then use tab to navigate to Ok and press enter.

It would be automatically configured, however it would ask if you want a database installed and configured, choose?yes and press enter

On the next screen you would be asked to enter the MySQL root password, that you provided in first step

next it would ask you to enter a password to be used by phpmyadmin to register with thedatabase (basically it would create a user called “phpmyadmin” the password is for that, most likely you won’t be needing this password ever. You can even choose to assign a random password for it.

Confirm that password on the next screen. Once you have made your choices the installation would finish and you should be able to access phpmyadmin by pointing your web browser to http://localhost/phpmyadmin/

install openvpn and gopenvpen on ubuntu 10.10

First,open a terminal ,type “sudo apt-get install openvpn” to install openvpn

Then,copy your config files (ca.crt, client.ovpn, *.crt,*.key) to /etc/openvpn

Now,let’s install the gopenvpn

wget http://mirror.sifnt.net.au/linux/dists/jaunty/main/binary-i386/gopenvpn_0.6-0sifnt_i386.deb
sudo dpkg -i gopenvpn_0.6-0sifnt_i386.deb

ok,now,we can run “Applications->Internet->gopenvpn”, input your password, you can see the icon on the Panel turn to green.

hesitating

Today, I tested the speed of my two sites, the result was less than satisfactory. So, I considered to use the internal host. But it says I must have an ICP ?license , and the host has so few service.

:( , I have 4 days to test the host in USA, come on!

new beginning

Today,?I make two new sites. One is this, my new blog. The other, is a site like GroupOn,www.bufan.cc.

so tired, go to sleep. Good luck~