安装环境
安装gcc,期间有提示,一律选y
[root@james nginx]#yum install gcc-c++
安装Nginx依赖环境,-y表示所有提示默认选择y
[root@james nginx]#yum -y install pcre pcre-devel
[root@james nginx]#yum -y install zlib zlib-devel
[root@james nginx]#yum -y install openssl openssl-devel
安装nginx运行环境
[root@james ~]# mkdir /usr/local/nginx
[root@james ~]# tar -zxvf nginx-1.13.9.tar.gz -C /usr/local/nginx
编译并安装
[root@james nginx]# cd nginx-1.13.9/
[root@james nginx]#./configure
// 如果有error, 再执行一次 [root@james nginx]#yum -y install pcre pcre-devel
[root@james ~]# make
[root@james ~]# make install
开放防火墙80端口
[root@james nginx]# vim /etc/sysconfig/iptables
插入
-I INPUT -p tcp --dport 80 -j ACCEPT
重新加载防火墙配置文件
[root@james nginx]# service iptables reload
观察index文件目录所在的根目录
[root@james nginx]# vim /usr/local/nginx/conf/nginx.conf
server {
listen 80; // 监听80端口
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /ly; // 项目跟路径, 修改成自己的项目路径(Linux)
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
部署静态网页的思路
-
上传自己的项目 PS ftp上传需要打成压缩包,再解压,记住解压的路径
-
修改nginx的配置,配置解压的路径
location / {
root /ly; // 项目跟路径, 修改成自己的项目路径(Linux)
index index.html index.htm;
}
重启nginx
[root@james ~]# cd /usr/local/nginx/
[root@james nginx]# ls
client_body_temp fastcgi_temp logs proxy_temp scgi_temp
conf html nginx-1.13.9 sbin uwsgi_temp
[root@james nginx]# cd sbin
停止Nginx
[root@james sbin]# ./nginx -s stop
启劝Nginx
[root@james sbin]# ./nginx
[ .
和./
的区别转载至]:https://blog.csdn.net/u014471752/article/details/84565908
linux 中在shell中使用 " . " 和 " ./ " 执行的区别
目前注意到的区别主要在于环境变量的作用域上:
-
如果使用" ./ " 执行,可以理解为程序运行在一个全新的shell中,不继承当前shell的环境变量的值, 同时若在程序中改变了当前shell中的环境变量(不使用export),则当前shell的环境变量值不变。
-
如果使用” . "执行,则程序继承当前shell中的环境变量,同时,若在程序中改变了当前shell中的环境变量(不使用export),则当前shell中该环境变量的值也会改变
另外一个区别点在于, “ ./ "只能用于拥有执行权限的文件, 而 ” . " 则可以暂时提升