Facebook founder Mark in the www.comflag.com20110501apache-web.htm movie social networks. after losing love, Zach intruded into the server of the dormitory building of Harvard University, stole database information, and completed an interactive website scoring girls in the school within two hours. The website hits over 10 million in a day, this directly causes the school server to crash.
Facebook founder Mark in the http://www.comflag.com/2011/05/01/apache-web.htm movie social networks. after losing love, Zach intruded into the server of the dormitory building of Harvard University, stole database information, and completed an interactive website scoring girls in the school within two hours. The website hits over 10 million in a day, this directly causes the school server to crash.
Http://www.comflag.com/2011/05/01/apache-web.htm
Facebook founder Mark in the movie social network. after losing love, Zach intruded into the server of the dormitory building of Harvard University, stole database information, and completed an interactive website scoring girls in the school within two hours. The website hits over 10 million in a day, directly causes the school server to crash ......
In fact, building such a website does not require many advanced technologies. Anyone with a certain network programming foundation can do this. Mark used Apache server and PHP server scripting language to build a website. I used three days to study PHP and wrote a website for the school for two weeks, it can be seen that PHP is very simple, and the facebook background is also written in php. Of course, the background of my wordpress blog is also php ~~.
In other words, many people may already use ubuntu, and they may spend a lot of time beautifying ubuntu, ubuntu should bring more convenience and convenience to our work and study. As a linux operating system, ubuntu provides us with powerful network functions. The server technology is particularly powerful and secure. If you do not learn linux network technology, it is hard to say that you have mastered linux.
Today, I configured an Apache server in ubuntu. Through Apache, we can learn php network programming and use it to deploy our local wordpress blog to further communicate with friends through the network. From then on, you will have a deep understanding of the magical power of the network, at least I think so ~~
Step 1: Install apache2
1 |
sudo apt-get install apache2
|
Installation is complete.
Run the following command to restart the instance:
1 |
sudo /etc/init.d/apache2 restart
|
Enter http: // localhost or http: // 127.0.0.1 in the browser. If It works is displayed !, It means that Apache is successfully installed. By default, Apache will create a directory named www under/var, which is the Web directory, all Web files that can be accessed through a browser must be placed in this directory.
Step 2: install php:
1 |
sudo apt-get install libapache2-mod-php5 php5
|
In addition, it is recommended to install the extension php5-gd php5-mysql, the installation method is the same as above.
After installation, restart Apache to load the PHP module:
1 |
sudo /etc/init.d/apache2 restart
|
Next, we will create a test. PHP file under the Web directory to test whether PHP can run normally. command:
1 |
sudo gedit /var/www/test.php
|
Then enter:
Save the file and enter http: // 127.0.0.1/test. php In the browser. If hello, world! is displayed on the webpage !!, It indicates that PHP is running normally.
Step 3: Install the mysql database:
1 |
sudo apt-get install mysql-server mysql-client
|
The apt-get program automatically downloads and installs the latest mysql version. At the end of the installation, it will require you to enter the root password. Note that the root password here is not the Ubuntu root password. It is the root password you want to set for MySQL.
Step 4: Install phpmyadmin-Mysql Database Management
1 |
sudo apt-get install phpmyadmin
|
Phpmyadmin settings:
During installation, You must select Web server: apache2 or lighttpd, use the space key to select apache2, press the tab key, and then click OK. Then, you are required to enter the Mysql database Password of the database's administrative user.
Then, establish a connection between phpmyadmin and apache2. Take my example: the www directory is in the/var/www directory, and the phpmyadmin directory is in the/usr/share/phpmyadmin directory. Therefore, run the following command:
1 |
sudo ln -s /usr/share/phpmyadmin /var/www
|
Create a link.
Phpmyadmin test: Open http: // localhost/phpmyadmin in the address bar of the browser.
The basic components of the above ALMP are installed. Next let's take a look at some other settings:
Step 5: Set the Ubuntu File Read and Write Permissions
After LAMP is installed, the default root directory of the PHP network server is/var/www. Due to the security principle of Linux, only root users are allowed to change the file read and write permissions under the directory. Therefore, you cannot create or delete PHP files in the www folder, you must first modify the read and write permissions of the/var/www directory. You cannot modify the File Permission by right-clicking the attribute in the interface manager. You must run the root terminal command:
1 |
sudo chmod 777 /var/www
|
. Then you can write html or PHP files. 777 is the highest permission in linux, which indicates readable, writable, and executable.