http://blog.csdn.net/guih168/article/details/6327814 If Google's topic, 80% of the results are ads-they will tell you, "Hey, I (or a company) here can build a website, fool-style yo, Come and run to me! "Novice generally feel that building a website is a super complex thing, so very naïve and innocent into the trap, and finally also cheerfully help the number of money." A fool's thing is like its name, just for a fool, to be extra careful.
I formally contact the computer in 2002, contact website Construction in 2003, think of time is not short, although not a master, but still have a certain say drop. A few months ago, Jiang Brother from live space to escape, set up their own nest, and recently put their own website and "Statistical capital" website have moved home, and then also help "Beta Planet" fled the convulsions of live Space, later a friend asked about how to set up a personal website, So simply write a tutorial, the site of the establishment of this website is clear.
First, the preparation of the site materials: domain name and space
A web site is usually composed of a domain name and a bunch of web page files:
- Domain name: is "Three tatsu don't slip what point pit" Such things (such as www.yihui.name, not strict, see something), administered by a nonprofit organization, ICANN, but it authorizes a number of Registrars (registrar) to sell domain names, and you can register them with the top-level domain names , the so-called top-level domain name is "letter or number combination + top-level domain name suffix", these suffixes include common com/org/net, also include uncommon name/info/biz, etc., the domain suffix that allows the registration of each family may be different, this looks like a person likes About the domain name suffix, originally it has meaning, such as com is company,org is organization,name is a personal domain name, and so on, but I personally think these things have not much meaning, domain name as long as good remember, look at the Smarty pants can be, Whether it is a company or an organization (there are exceptions: such as the special suffix of the General people can not register), the famous del.icio.us website is a good example, it does not have to be the United States website, but this domain name is very clever registration. Under the top-level domain name can be set sub-domain name, such as level two three domain name, strictly speaking, Www.yihui.name is only yihui.name two sub-domain, but www too popular, so that people simply take www.***.*** as a top-level domain name. Animation.yihui.name is a sub-domain/sub-station of this site. Said a long, domain name how to register AH? You google a "domain name registration" or "Domain name registration", the top sponsored link is a strong registrar, but I as an experienced to seriously remind that, try to do not register in the country (especially don't trust the nonsense of the million-net). It is said that GoDaddy can also, I have not tried, only know that it does not seem to register. Name Domain name, I am the domain name registered in name.com (need to pay USD, I use PayPal, dual currency credit card can also).
- Website space: Think simple, space and your hard disk no difference, but is a space service provider sold you a piece of server hard disk location, performance may be better than your PC, site space is to put the Web page files, Web files you can simply imagine as your hard disk files, they are also accessed by the path, The path to the URL corresponds to the folder on the hard drive. Web page files are usually divided into:
- Static Web page: its content is fixed, with HTML code (a language of the Web page), regardless of who, regardless of time access, the content is the same, usually with. html/.htm as the file name
- Dynamic Web page: I estimate that most of the sites are dynamic now, so-called dynamic is the Web file will be based on different conditional parsing generated different HTML code, for example: a dynamic page According to the time and user ID say hello to the visitor, morning visit said Good morning, evening visit said Good evening, Passers-by came to say hello to passers-by ... Dynamic pages are usually linked to the database, and when the user accesses the Web page, the Web program accesses the database, so the page content is constantly updated. Dynamic pages may be written in different languages, such as the old Microsoft ASP, the popular open source PHP. Now there are countless web sites on the network, I certainly respected php+mysql system, at present, especially optimistic about the WordPress system.
- Note that some of the foreign space can be used almost as their own computer, including compiling the installer (such as Python), ssh login, MySQL can be executed on the command line, and so on, it seems that the country has not seen a space so much freedom
Domain name and space is not necessarily connected, the role of the domain name is mapped as a string to an IP address, because (1) The IP address is too difficult to remember (2) The number of IP addresses is limited (the same IP can put n domain names) so it is necessary domain name such a thing. This means that you have the Freedom to change space. Which day on the space service provider is not happy, you can directly kicked him, the domain name to other places to go, with another space. Hey, wait, what is domain name parsing ?
Ii. about the configuration of the website 1, the setting of the domain name
Registered domain name after the silver, the domain name is yours, if you are registered in the country, you pay to buy the domain name is not really your. Be sure to see if you have the following rights:
- Modify registered contacts, management contacts, technical contacts and paid contact information, if you can not find in the background changes in the place, then congratulate you, this domain name seems not you, but a dishonest businessman, use Whois to check the domain name information it;
- Get the Authorization Code (AUTH code), there is also called the Domain name transfer password, this code is very important, if you do not know or unscrupulous businessmen do not tell you, that again congratulations, this domain name is still not yours, want to move to another registrar can not move, in case you do not encounter this situation, then go to ICANN complaints merchants, Complain three times a day, if a registrar is always complained, ICANN will fix it, and you must know what your rights as a consumer are.
If the domain name really belongs to you, then you are not happy with the Registrar any day, you can also kick it off, transfer to another registrar.
The domain name is set up primarily with some parsing work, including:
- Name server: Usually a URL such as ns*.***.***, this server is responsible for parsing the following various settings, that is, it is the boss of the domain name settings. Some of the domestic domain name registrars usually use this as a means to get stuck with users, such as restricting your only domain name servers, and then restricting you to set up up to 10 A records or MX records, and so on, this is a very ridiculous rule, especially for those who need more subdomains, this is very inconvenient , the situation is better abroad, at least I have not seen any restrictions on your use of a specific domain name server;
- A special mention is that some space service providers only need you to set the domain name server as their domain name server, all the remaining resolution problems you basically do not have to control, you can freely create subdomains, without having to add a record
- A record: is to point the domain name to the host IP, you can point the top-level domain name or sub-domain name to a specific IP, so your sub-domain name and top-level domain name can not be on the same server, For example, I can point www.yihui.name to 18.104.22.168, Test.yihui.name to 127.0.0.1, and so on.
- MX record: Is the mail server, we know that the mailbox is the form of ***@***.***, when you send the mail point "sent", first your mail service provider to the domain name of your recipient to find its MX record, and then send the mail to the corresponding (another) mail service provider, For example, my domain name Yihui.name's MX record is aspmx.l.google.com, that is, GOOGLE apps mail Service address, when you send [email protected] e-mail, System first to look for Yihui.name MX record, a look, oh, Google Ah, then the delivery to Google home, Google received mail, a look, oh, to send to the Xie user Ah, then sent to the Xie Inbox it; I remember the sogou seems to have provided free mail service, I do not know that it is still not in, I've been using Google Apps for a long time.
- CNAME: Alias, this thing is a domain "mask", For example, if I set Google.yihui.name's cname to google.com, then you actually visit Google when you visit the former, and any path contained in the domain name will be passed to google.com intact, such as Google.yihui.name /services/is accessing google.com/services/, but the address in your browser's address bar does not show the latter, but instead displays the "masquerading" address. So as long as I am happy, I am free to make news, such as "Google changed the URL, the new URL is google.xiexie.name."
- Other settings: Don't say, theoretically a record is enough, nothing else.
2, the host settings
After the domain name has been set up, the host also needs some echo work. If the domain name is set to a record, but the host does not "receive", the website also cannot use. Host how to receive depends on its installed website service program, now popular is Apache, of course, there are a few sites still holding windows IIS thigh (with ASP language +access database), it is said that in recent time a new software, there is the possibility of replacing Apache, the name has been forgotten. Take Apache for example, the host will create a virtual host configuration file, tell the server, "Hey, there is a website point to you, you want to serve this site, this site in a directory, if users visit a URL, You are responsible for taking the files out of the directory to the user to see. "The general principle is this, the details are not much to say."
For the user, do not care so much detail, the above principle of implementation for you is in the background to bind the domain name to the host directory (and sub-domain name binding to subdirectories). In general, the site needs two additional tools to allow the owner to configure their own site, that is, FTP and database.
(1) Transferring Web files with FTP
FTP is used to transfer files to a certain server, as long as you purchase a virtual hosting service, you will generally give you an FTP account, you can use this account to log in to your host, the Web page files, and then users can access. A little common sense is that index.htm/ index.php such as web files is usually when you access a directory when the host will automatically find the files for you, such as you visit Yihui.name, the host will automatically find there is no index.php, if there is, execute this file, generate HTML to your browser. The file name may be configurable, but it is not recommended to be a maverick.
Now a lot of mature station system, downloaded from the Internet and then uploaded to the server, access to your Web site, follow the prompts step by step configuration, with the installation of software is no different.
(2) Website database
Most dynamic sites require a database (even a text file "database"), and if your website is in PHP, then MySQL is perfect. If the Php+mysql space (the General Linux host is this), the host will assign you the MySQL database account number, including: Database host (mostly localhost), database name, user name, password. These four items will require you to fill in the process of installing the Web application.
Third, the operation of the website
For those programmers, the first example is usually Hello world, and if you want to see Hello World, write "Hello World" with any text editing tool in a text file. Named index.htm (Note that Windows hides the file name extensions by default!) You make sure the file name is not index.htm.txt, I don't care, upload to the root of the website, and then visit your website, you can be delighted to see this old no longer old Hello world.
A decent site is certainly not Hello world so simple, it runs like a complex program, there may be function calls between files and database access and so on. The world really develop Web site program is certainly a few people, so do not worry, you use other people's program it, typical web system has:
- Blog System (blog): Recommended WordPress, the reason is that the program is written concise, strong extensibility, I used to use domestic bo-blog system, and later did not have to live the temptation to go to WP
- Content Management System (CMS): News gossip station, tutorial station, and so on, as the name implies is filled content, this site probably is to copy each other, not a few serious write, so in order to alleviate the pressure of reading, please Sir Cherish life, away from this site, also do not repeat the construction
- Forum System (BBS): Netizens should be very familiar with this, the domestic common system has phpwind, discuz, foreign flourished has phpbb, I personally recommend a relatively new debut bbpress, the reason with WordPress, In everyone desperately to increase the functionality of today (make users face a lot of options to burn), rare to see a desperately reduced function of the forum system
- Wiki: Wikipedia uses the MediaWiki system, and if you don't want the wiki to interact with the database, DokuWiki will be a good choice, it doesn't require database support, it's all text file operations.
The installation of the site did not say anything, the general is to put the Web file on the end of the server, and then visit your Web site, follow the prompts to walk. The site name is set to the name, the password to lose passwords. Then you will realize that a small individual can also create a seemingly scary big website.
But the maintenance of the site is not a simple thing, and when you have the right to face all the options, you will feel pain. Like my this kind of amateur play for several years the site of people are almost an occupational disease, where no alignment will feel uncomfortable, where a space is less than one eye to see, paragraph the first space indent 2 characters or 1.9 characters feel is not the same. All things you can change, you are willing to decorate on how to decorate. Just a text editor and FTP, you can change the biography, spread the look, looked at the change. It's no longer a perpetual robbery. So build a website to have a good mentality, do not perfect mentality, otherwise this life will have to constantly change. Now the website system update also fast, go out has new function, see your heart itch: Should I put a plug-in/change a B theme ah? Zhang San home has a very cool function, I want to think about how to do it? ......
So, I suggest you crossing to learn HTML and CSS and Php+mysql, or not to recommend it? I don't know.
There are search engine optimization (SEO), take some strategy to make search engine like your website, make your search ranking up front, you have to learn what is meta information (keywords, description), what is 301 redirect, what is 404 error, What is the Apache rewrite module what is pseudo static URL;
The first time you see the summary written to the last?
- Buy domain names, avoid unscrupulous businessmen, suggestions through your familiar friends introduced, not on Google; if you buy abroad, you can pay by credit card or PayPal that supports US dollars, and the domain name is paid every year.
- Buy virtual hosting space, avoid unscrupulous businessmen, recommend through your familiar friends introduce, not also do not feel free Google, because space performance is very important, do not try not to know, according to your site needs to buy the space (static? Dynamic? How big does it take? ), domestic divided into different types of space, may be charged by size, foreign according to my understanding of the hostmonster is no size limit, a price, open let you casually use, of course, will always be limited by the size of the hard disk
- Set up a domain name server or a record, point to host
- Upload the Web page file via FTP and visit your new website
- Configure your site, you can usually log in to the site background for settings, usually do some daily updates, see the function of jealousy can also DIY out
- If you have to buy a virtual host in my wise Shenwu, then congratulations you still have the most important step is to go to the wise Shenwu of the public Peacemaker department there to prepare a bird case, the record Web site search it, whether you can prepare your own incense, I do not care, a day do not record, a day site should not run, the host service will put you
Set up a full set of processes and detailed explanations of the site