lnmp之nginx1.10.2安装

linux下nginx的安装

为了后面避免缺失,还是什么都安装一下(后面安装php和mysql就不需要重复再执行下面这个了,当然你再执行一遍也没问题)

[root@localhost src]# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel

好,输入y是确定,ok,就这样, 安装成功,接着下面

[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# wget http://nginx.org/download/nginx-1.10.2.tar.gz

[root@localhost src]# tar vfxz nginx-1.10.2.tar.gz

[root@localhost src]# cd nginx-1.10.2

[root@localhost nginx-1.10.2]# ./configure --prefix=/usr/local/nginx

[root@localhost nginx-1.10.2]# make && make install

等待几分钟,就会编译安装好

启动nginx

[root@localhost nginx-1.10.2]# cd /usr/local/nginx

[root@localhost nginx]# ./sbin/nginx

ok,可以看到启动成功了!可喜可贺,下面请看我的php安装...

 平滑重启nginx:/usr/nginx/sbin/nginx -s reload 

 

 

自己的事情,别看,在xampp上配置虚拟主机

<VirtualHost *:80>  
    DocumentRoot "C:\xampp\htdocs\zijiu\web"  
    ServerName hello.world.cn  
    <Directory />  
        AllowOverride All  
        Order deny,allow  
        Allow from all  
    Require all granted  
    </Directory>  
</VirtualHost>

<VirtualHost *:80>  
    DocumentRoot "J:\git-yii2-xiangmu\Shop-PHP-Yii2\backend\web"  
    ServerName www.gogo.com  
    <Directory />  
        AllowOverride All  
        Order deny,allow  
        Allow from all  
    Require all granted  
    </Directory>  
</VirtualHost>

 

<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs\zijiu\web"
DirectoryIndex index.html index.htm index.php
<Directory D:\xampp\htdocs\zijiu\web>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

posted @ 2017-01-10 20:55  岁月静好13543  阅读(226)  评论(0编辑  收藏  举报
AmazingCounters.com