<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[iyunv@vm_101 ~]# vim /etc/nginx/nginx.conf ##在HTTP段添加一条配置项:
http {
include mime.types;
include server.conf; ###添加这一行
default_type application/octet-stream;
2、在/etc/nginx/目录下创建server.conf文件
1
2
3
4
5
6
7
8
9
10
11
[iyunv@vm_101 ~]# vim /etc/nginx/server.conf
server {
listen 80;
server_name www.test.com;
location / {
root /home/html;
index index.html;
}
}
[iyunv@vm_101 ~]# vim /home/html/index.html
<h1>test file</h1>
[iyunv@vm_101 ~]# /etc/init.d/nginx reload
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Reloading nginx: [ OK ]
[iyunv@vm_101 ~]# curl http://www.test.com
<h1>test file</h1>
正常访问。
五、编译安装、配置mysql
1、创建用户与相应的目录
1
2
3
4
5
[iyunv@vm_101 ~]# groupadd -r mysql
[iyunv@vm_101 ~]# useradd -r -g mysql -s /sbin/nologin mysql
[iyunv@vm_101 ~]# mkdir /home/mysql #mysql的数据目录
[iyunv@vm_101 ~]# chown -R mysql:mysql /home/mysql/
[iyunv@vm_101 ~]# mkdir /usr/local/mysql #mysql的安装目录
2、解压缩
1
2
[iyunv@vm_101 ~]# tar zxvf mysql-5.6.20.tar.gz -C /opt/
[iyunv@vm_101 ~]# cd /opt/mysql-5.6.20/
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Download failed, error: 7;"couldn't connect to server"
-- To enable google test, please download http://googlemock.googlecode.com/files/gmock-1.6.0.zip to the directory /opt/mysql-5.6.20/source_downloads
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/mysql-5.6.20
CMake Error: Problem with tar_extract_all(): Invalid argument
CMake Error: Problem extracting tar: /usr/local/src/mysql-5.6.13/source_downloads/gmock-1.6.0.zip
谷歌了一下,需要个手动解压该文件:
1
2
3
4
5
6
[iyunv@vm_101 mysql-5.6.20]# cd source_downloads/
[iyunv@vm_101 source_downloads]# unzip gmock-1.6.0.zip
[iyunv@vm_101 source_downloads]# cd gmock-1.6.0
[iyunv@vm_101 source_downloads]# cd gmock-1.6.0
[iyunv@vm_101 gmock-1.6.0]# ./configure
[iyunv@vm_101 gmock-1.6.0]# make