设为首页 收藏本站
查看: 2714|回复: 1

Linux LNMP环境的搭建 详细步骤

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-12-29 15:36:51 | 显示全部楼层 |阅读模式
Nginx的编译安装
1
2
3
4
5
6
7
8
9
10
11
12
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
cd /root/tools
wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
useradd nginx -s /sbin/nologin -M
tar xf nginx-1.6.3.tar.gz
cd nginx-1.6.3
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -s /application/nginx-1.6.3 /application/nginx
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx




Mysql 的安装
源码安装包的解压
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[iyunv@test ~]# groupadd mysql
[iyunv@test ~]# useradd -s /sbin/nologin -g mysql -M mysql
[iyunv@test ~]# tail -1 /etc/passwd
mysql:x:500:500::/home/mysql:/sbin/nologin
[iyunv@test ~]# id mysql
uid=500(mysql) gid=500(mysql) groups=500(mysql)
[iyunv@test ~]# mkdir -p /root/tools
[iyunv@test ~]# cd /root/tools/
[iyunv@test tools]# ll
total 182348
-rw-r--r--. 1 root root 186722932 Dec 21 02:25 mysql-5.5.32-linux2.6-x86_64.tar.gz
[iyunv@test tools]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
[iyunv@test tools]# mkdir -p /application/
[iyunv@test tools]# mv mysql-5.5.32-linux2.6-x86_64 /application/mysql-5.5.32
[iyunv@test tools]# ln -sv /application/mysql-5.5.32/ /application/mysql
`/application/mysql' -> `/application/mysql-5.5.32/'
[iyunv@test tools]# ll /application/
total 4
lrwxrwxrwx.  1 root root   26 Dec 21 02:27 mysql -> /application/mysql-5.5.32/
drwxr-xr-x. 13 root root 4096 Dec 21 02:27 mysql-5.5.32




初始化Mysql的配置文件
1
2
3
4
5
6
7
8
9
10
11
[iyunv@test mysql]# cd /application/mysql
[iyunv@test mysql]# ll support-files/*.cnf
-rw-r--r--. 1 7161 wheel  4691 Jun 19  2013 support-files/my-huge.cnf
-rw-r--r--. 1 7161 wheel 19759 Jun 19  2013 support-files/my-innodb-heavy-4G.cnf
-rw-r--r--. 1 7161 wheel  4665 Jun 19  2013 support-files/my-large.cnf
-rw-r--r--. 1 7161 wheel  4676 Jun 19  2013 support-files/my-medium.cnf
-rw-r--r--. 1 7161 wheel  2840 Jun 19  2013 support-files/my-small.cnf
[iyunv@test mysql]# cp support-files/my-small.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? yes
[iyunv@test mysql]# ll /etc/my.cnf
-rw-r--r--. 1 root root 2840 Dec 21 02:29 /etc/my.cnf




初始化Mysql数据库文件
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
[iyunv@test mysql]# mkdir -p /application/mysql/data
[iyunv@test mysql]# chown -R mysql.mysql /application/mysql/
[iyunv@test mysql]# /application/mysql/scripts/mysql_install_db  --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
WARNING: The host 'test' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/application/mysql/bin/mysqladmin -u root password 'new-password'
/application/mysql/bin/mysqladmin -u root -h test password 'new-password'
Alternatively you can run:
/application/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /application/mysql ; /application/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /application/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /application/mysql/scripts/mysqlbug script!
[iyunv@test mysql]#




安装有两个OK的字样,表示初始化成功,

以上的初始化命令生成的数据库文件如下:
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
[iyunv@test mysql]# tree /application/mysql/data/
/application/mysql/data/
├── mysql
│   ├── columns_priv.frm
│   ├── columns_priv.MYD
│   ├── columns_priv.MYI
│   ├── db.frm
│   ├── db.MYD
│   ├── db.MYI
│   ├── event.frm
│   ├── event.MYD
│   ├── event.MYI
│   ├── func.frm
│   ├── func.MYD
│   ├── func.MYI
│   ├── general_log.CSM
│   ├── general_log.CSV
│   ├── general_log.frm
│   ├── help_category.frm
│   ├── help_category.MYD
│   ├── help_category.MYI
│   ├── help_keyword.frm
│   ├── help_keyword.MYD
│   ├── help_keyword.MYI
│   ├── help_relation.frm
│   ├── help_relation.MYD
│   ├── help_relation.MYI
│   ├── help_topic.frm
│   ├── help_topic.MYD
│   ├── help_topic.MYI
│   ├── host.frm
│   ├── host.MYD
│   ├── host.MYI
│   ├── ndb_binlog_index.frm
│   ├── ndb_binlog_index.MYD
│   ├── ndb_binlog_index.MYI
│   ├── plugin.frm
│   ├── plugin.MYD
│   ├── plugin.MYI
│   ├── proc.frm
│   ├── proc.MYD
│   ├── proc.MYI
│   ├── procs_priv.frm
│   ├── procs_priv.MYD
│   ├── procs_priv.MYI
│   ├── proxies_priv.frm
│   ├── proxies_priv.MYD
│   ├── proxies_priv.MYI
│   ├── servers.frm
│   ├── servers.MYD
│   ├── servers.MYI
│   ├── slow_log.CSM
│   ├── slow_log.CSV
│   ├── slow_log.frm
│   ├── tables_priv.frm
│   ├── tables_priv.MYD
│   ├── tables_priv.MYI
│   ├── time_zone.frm
│   ├── time_zone_leap_second.frm
│   ├── time_zone_leap_second.MYD
│   ├── time_zone_leap_second.MYI
│   ├── time_zone.MYD
│   ├── time_zone.MYI
│   ├── time_zone_name.frm
│   ├── time_zone_name.MYD
│   ├── time_zone_name.MYI
│   ├── time_zone_transition.frm
│   ├── time_zone_transition.MYD
│   ├── time_zone_transition.MYI
│   ├── time_zone_transition_type.frm
│   ├── time_zone_transition_type.MYD
│   ├── time_zone_transition_type.MYI
│   ├── user.frm
│   ├── user.MYD
│   └── user.MYI
├── performance_schema
│   ├── cond_instances.frm
│   ├── db.opt
│   ├── events_waits_current.frm
│   ├── events_waits_history.frm
│   ├── events_waits_history_long.frm
│   ├── events_waits_summary_by_instance.frm
│   ├── events_waits_summary_by_thread_by_event_name.frm
│   ├── events_waits_summary_global_by_event_name.frm
│   ├── file_instances.frm
│   ├── file_summary_by_event_name.frm
│   ├── file_summary_by_instance.frm
│   ├── mutex_instances.frm
│   ├── performance_timers.frm
│   ├── rwlock_instances.frm
│   ├── setup_consumers.frm
│   ├── setup_instruments.frm
│   ├── setup_timers.frm
│   └── threads.frm
└── test
    └── db.opt
3 directories, 91 files






初始化的时候可能的错误:
错误一

1
WARRNING:the host'test'could not be looked up with resolveip.



需要修改主机名的解析,使其和uname -n一样,修改后的结果如下:
1
2
[iyunv@test mysql]# grep `uname -n` /etc/hosts
127.0.0.1 test localhost.localdomain localhost




错误二

1
ERROR: 1004 Can't create file'/temp/#sql300e_1_0.frm'(errno :13)



可能是/tmp权限的问题解决办法
1
chmod -R 1777 /tmp




配置并启动Mysql
1        设置启动脚本:
1
2
[iyunv@test mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[iyunv@test mysql]# chmod +x /etc/init.d/mysqld



2        Mysql默认安装路径是/usr/local/mysql,启动脚本里是/usr/local/mysql的路径都需要替换:
1
[iyunv@test mysql]# sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld



3        启动Mysql数据库
1
2
[iyunv@test mysql]# /etc/init.d/mysqld start
Starting MySQL...                                          [  OK  ]



4        检查Mysql数据是否启动成功
1
2
3
4
5
6
[iyunv@test mysql]# netstat -lntup|grep mysql
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2330/mysqld
[iyunv@test mysql]# lsof -i :3306
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mysqld  2330 mysql   10u  IPv4  23130      0t0  TCP *:mysql (LISTEN)
如果没发现3306,可以  tail -100 /application/mysql/data/机器名.err查看日志信息



5        查看Mysql数据库启动的日志
1
2
3
4
5
6
7
8
9
10
11
[iyunv@test mysql]# tail -10 /application/mysql/data/test.err
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
161221  2:43:58  InnoDB: Waiting for the background threads to start
161221  2:43:59 InnoDB: 5.5.32 started; log sequence number 0
161221  2:43:59 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161221  2:43:59 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
161221  2:43:59 [Note] Server socket created on IP: '0.0.0.0'.
161221  2:43:59 [Note] Event Scheduler: Loaded 0 events
161221  2:43:59 [Note] /application/mysql/bin/mysqld: ready for connections.
Version: '5.5.32'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server (GPL)



6        设置Mysql开机自动启动
1
2
3
4
[iyunv@test mysql]# chkconfig --add mysqld
[iyunv@test mysql]# chkconfig mysqld on
[iyunv@test mysql]# chkconfig --list mysqld
mysqld         0:off1:off2:on3:on4:on5:on6:off



7        配置mysql命令的全局使用路径
1
2
3
4
5
6
[iyunv@test mysql]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
[iyunv@test mysql]# tail -1 /etc/profile
export PATH=/application/mysql/bin:$PATH
[iyunv@test mysql]# source /etc/profile
[iyunv@test mysql]# echo $PATH
/application/mysql/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin



8        登录测试Mysql,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> quit




为Mysql的root用户设置密码
1
2
3
4
5
[iyunv@test mysql]# mysqladmin -u root password '123qwe'
[iyunv@test mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[iyunv@test mysql]# mysql -u root -p
Enter password:





清理无用的Mysql用户及库
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
mysql> select user,host from mysql.user;    ###
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
|      | localhost |
| root | localhost |
|      | test      |
| root | test      |
+------+-----------+
6 rows in set (0.00 sec)
mysql> drop user ""@"localhost";   ###
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ""@"test";
Query OK, 0 rows affected (0.00 sec)
mysql> drop user "root"@"test";
Query OK, 0 rows affected (0.00 sec)
mysql> drop user "root"@"::1";
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;   ###
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
+------+-----------+
2 rows in set (0.00 sec)




如果不能删除用户
1
2
mysql> drop user "root"@"::1";
ERROR 1396 (HY000): Operation DROP USER failed for 'root'@':1'



解决办法:
1
2
3
4
mysql> delete from mysql.user where user="and host=::1" ;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)



现在就可以删除无用的数据库了
1
2
mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)




PHP的安装

一、什么是CGI
全称“通用网关接口”(Common Gateway Interface),为HTTP服务与其他机器上的程序服务通信交流的一种工具,CGI程序须运行在网络服务器上。
FastCGI,在linux下FastCGI接口即为socket,可以使文件socket,也可以是IP socket,
FastCGI的重要特点如下:
HTTP服务器和动态脚本语言间通信的接口或工具;
可把动态语言解析和HTTP服务器分离开;
Nginx、Apache、Lighttpd,以及多数动态语言都支持FastCGI;
FastCGI接口方式采用C/S结构,分客户端(HTTPfuwuqi )和服务端(动态语言解析服务器)
PHP动态语言服务器端可以启动多个FastCGI的守护进程(例如php-fpm(fcgi process management))
HTTP服务器通过(例如Nginx fastcgi_pass)FastCGI客户端和动态语言FastCGI服务器端通信(例如php-fpm)

二、Nginx FastCGI的运行原理
三、LNMP的PHP(FastCGI方式)服务的安装准备
一、检查确认Nginx及Mysql的安装路径
1
2
3
4
[iyunv@test nginx-1.6.3]# ll -d /application/mysql
lrwxrwxrwx. 1 root root 26 Dec 21 02:27 /application/mysql -> /application/mysql-5.5.32/
[iyunv@test nginx-1.6.3]# ll -d /application/nginx
lrwxrwxrwx. 1 root root 24 Dec 21 03:34 /application/nginx -> /application/nginx-1.6.3



二、检查端口及启动情况
1
2
3
[iyunv@test nginx-1.6.3]# netstat -lntup|grep -E "80|3306"
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2330/mysqld
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      27326/nginx



三、测试访问Nginx及Mysql是否OK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[iyunv@test nginx-1.6.3]# wget 127.0.0.1
--2016-12-21 03:36:58--  http://127.0.0.1/
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 612 [text/html]
Saving to: “index.html”
100%[==============================================>] 612         --.-K/s   in 0s
2016-12-21 03:36:58 (149 MB/s) - “index.html” saved [612/612]
[iyunv@test nginx-1.6.3]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.5.32 MySQL Community Server (GPL)
.......



四、检查安装PHP所需要的lib库
1
2
3
4
[iyunv@test nginx-1.6.3]# rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
[iyunv@test nginx-1.6.3]# yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
[iyunv@test nginx-1.6.3]# rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
[iyunv@test nginx-1.6.3]# yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel



五、安装yum无法安装libiconv库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[iyunv@test nginx-1.6.3]# cd /root/tools/
[iyunv@test tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
--2016-12-21 03:42:51--  http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
Resolving ftp.gnu.org... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org|208.118.235.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4984397 (4.8M) [application/x-gzip]
Saving to: “libiconv-1.14.tar.gz”
100%[==============================================>] 4,984,397    276K/s   in 13s
2016-12-21 03:43:05 (370 KB/s) - “libiconv-1.14.tar.gz” saved [4984397/4984397]
[iyunv@test tools]# tar zxf libiconv-1.14.tar.gz
[iyunv@test tools]# cd libiconv-1.14
[iyunv@test libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
[iyunv@test libiconv-1.14]# make
[iyunv@test libiconv-1.14]# make install



六、安装libmcrypt库
1
2
3
4
[iyunv@test tools]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
[iyunv@test tools]# cp epel-6.repo /etc/yum.repos.d/epel.repo
[iyunv@test tools]# cat /etc/yum.repos.d/epel.repo
[iyunv@test tools]# yum -y install libmcrypt-devel



七、安装mhash加密扩展库
1
yum -y install mhash



八、安装mcrypt加密扩展库
1
yum -y install mcrypt




PHP服务的安装
一、解压配置软件包
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
[iyunv@test root]# cd /root/tools
[iyunv@test php-5.3.27]# tar zxf php-5.3.27.tar.gz
[iyunv@test php-5.3.27]#./configure \
--prefix=/application/php5.3.27 \
--with-mysql=/application/mysql \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp




二、编译PHP
1
2
3
4
[iyunv@test php-5.3.27]# ln -sv /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
[iyunv@test php-5.3.27]# touch ext/phar/phar.phar
[iyunv@test php-5.3.27]# make
[iyunv@test php-5.3.27]# make install



三、配置PHP引擎配置文件php.ini
1、设置软连接以方便访问:
1
2
3
4
[iyunv@test php-5.3.27]# ln -sv /application/php5.3.27 /application/php
`/application/php' -> `/application/php5.3.27'
[iyunv@test php-5.3.27]# ll /application/php
lrwxrwxrwx. 1 root root 22 Dec 21 04:29 /application/php -> /application/php5.3.27



2、查看PHP配置默认模板文件
1
2
3
[iyunv@test php-5.3.27]# ll php.ini*
-rw-r--r--. 1 101 101 69606 Jul 11  2013 php.ini-development
-rw-r--r--. 1 101 101 69627 Jul 11  2013 php.ini-production



开发环境更多的是开启日志、调试信息,而生产环境都是关闭状态
3、拷贝PHP配置文件到PHP默认目录,并更改文件名称为php.ini:
1
2
3
[iyunv@test php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
[iyunv@test php-5.3.27]# ll /application/php/lib/php.ini
-rw-r--r--. 1 root root 69627 Dec 21 04:33 /application/php/lib/php.ini



四、配置PHP服务(FastCGI方式)的配置文件php-fpm.conf
1
2
3
4
5
6
[iyunv@test php-5.3.27]# cd /application/php/etc/
[iyunv@test etc]# ll
total 28
-rw-r--r--. 1 root root  1232 Dec 21 04:26 pear.conf
-rw-r--r--. 1 root root 21683 Dec 21 04:25 php-fpm.conf.default
[iyunv@test etc]# cp php-fpm.conf.default php-fpm.conf



五、启动PHP服务(FastCGI方式)
1、启动PHP服务php-fpm
1
[iyunv@test etc]# /application/php/sbin/php-fpm



2、检查PHP服务php-fpm的进程及端口启动情况
1
2
3
4
5
[iyunv@test etc]# ps -ef|grep php-fpm
root      30568      1  0 04:36 ?        00:00:00 php-fpm: master process (/application/php5.3.27/etc/php-fpm.conf)
nginx     30569  30568  0 04:36 ?        00:00:00 php-fpm: pool www
nginx     30570  30568  0 04:36 ?        00:00:00 php-fpm: pool www
root      30572   1900  0 04:36 pts/0    00:00:00 grep php-fpm



六、配置Nginx支持PHP程序请求访问
1、查看Nginx的当前配置
1
2
3
[iyunv@test etc]# cd /application/nginx/conf/
[iyunv@test conf]# cp nginx.conf nginx.conf.02
[iyunv@test conf]# cat nginx.conf



2、以blog为例
1
2
3
4
5
6
7
8
9
10
11
12
13
[iyunv@test nginx]# cat conf/extra/blog.conf
server {
listen       80;
server_name blog.abc.com;
location / {
root   html/blog;
index  index.html index.htm;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
}




最终blog虚拟主机的完整配置如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@test nginx]# cat conf/extra/blog.conf
server {
listen       80;
server_name blog.abc.com;
location / {
root   html/blog;
index  index.html index.htm;
}
location ~.*\.(php|php5)$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
error_page   500 502 503 504  /50x.html;
#location = /50x.html {
#    root   html;
#}
}
}



检查语法并重启Nginx
1
2
3
4
[iyunv@test blog]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[iyunv@test blog]# /application/nginx/sbin/nginx -s reload



测试LNMP环境是否生效
在/application/nginx/html/blog下创建一个php文件
1
2
3
4
5
[iyunv@test blog]# cat /application/nginx/html/blog/index.php
<?php
phpinfo();
?>
[iyunv@test blog]#



修改本地计算机(本人是WINDOWS 10)hosts文件的DNS,并访问blog.abc.com

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-321144-1-1.html 上篇帖子: wampserver 使用openssl和apache搭建https服务器教程 下篇帖子: Centos7部署lamp: httpd2.4(prefork)+module模式 Linux
累计签到:26 天
连续签到:1 天
发表于 2017-1-14 09:17:39 | 显示全部楼层
写的很详细,收藏了!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表