nginx基本操作

安装:

yum install nginx

启动:

service nginx start

停止:


service nginx stop

重载:


service nginx reload

部署NGINX:

// $ sudo service httpd stop
$ sudo yum install nginx

查看是否启动:


$ ps -ef | grep nginx

启动:

$ sudo service nginx start
$ sudo service nginx reloadfirewall-cmd --zone=public --add-port=80/tcp --permanent
防火墙开启80端口
firewall-cmd --reload
防火墙重载
yum install iptables-services
systemctl enable iptables
systemctl stop firewalld
systemctl start firewalld

配置/etc/nginx/下的配置文件:

因为在nginx主配置文件中引入了conf.d文件夹中的:
include /etc/nginx/conf.d/*.conf;
所以在nginx/conf.d/下面添加qingyun.conf文件进行配置.

主配置文件如下:

    # For more information on configuration, see:#   * Official English Documentation: http://nginx.org/en/docs/#   * Official Russian Documentation: http://nginx.org/ru/docs/user root;worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# Load dynamic modules. See /usr/share/nginx/README.dynamic.include /usr/share/nginx/modules/*.conf;events {worker_connections 1024;}http {log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log  /var/log/nginx/access.log  main;sendfile            on;tcp_nopush          on;tcp_nodelay         on;keepalive_timeout   65;types_hash_max_size 2048;include             /etc/nginx/mime.types;default_type        application/octet-stream;# Load modular configuration files from the /etc/nginx/conf.d directory.# See http://nginx.org/en/docs/ngx_core_module.html#include# for more information.include /etc/nginx/conf.d/*.conf;server {listen       80 default_server;listen       [::]:80 default_server;server_name  _;root         /usr/share/nginx/html;# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf;location / {}error_page 404 /404.html;location = /40x.html {}error_page 500 502 503 504 /50x.html;location = /50x.html {}}}
  1. 首先主配置文件,修改用户组

    user root;

2.然后进行操作:

cd conf.d
touch abcdefg.conf  //新建文件
vim abcdefg.conf

修改abcdefg.conf:

server {listen       80;server_name  **.**.***.**;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   /home/******/******;index  index.html index.htm;try_files $uri /index.html;}#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;}}

react-router在nginx上的应用,参照:

调整nginx正确服务react-router应用

注意在linux进行解压文件时

unrar e build.rar build

这样会把build.rar里面所有的文件都解压到build文件夹,不保持原有的目录。

unrar x build.rar build

这样解压会保持原有的目录。

Nginx 安装使用相关推荐

  1. 一、nginx 安装

    添加官方 yum 源 1 vim /etc/yum.repos.d/nginx.rep 输入以下内容(OS为你的系统,OSRELEASE 系统版本) 1 [nginx] 2 name=nginx re ...

  2. Linux环境Nginx安装多版本PHP

    关于Linux环境Nginx安装与调试以及PHP安装参考此文即可:http://blog.csdn.net/unix21/article/details/8544922 linux版本:64位Cent ...

  3. red5下nginx安装配置

    http://zfl110.iteye.com/blog/1155149 原址:http://lqw.iteye.com/blog/652763  安装Nginx 1.首先安装pcre-8.02.ta ...

  4. nginx安装 问题 1

    ./configure: error: the HTTP rewrite module requires the PCRE library 有时候,我们需要单独安装nginx,来处理大量的下载请求.单 ...

  5. Centos nginx 安装 源码方式安装

    以 yum 方式安装 Nginx https://andyoung.blog.csdn.net/article/details/118802486 安装所需插件 1.安装gcc gcc是linux下的 ...

  6. nginx安装-添加MP4播放模块

    nginx安装很简单,但是有的时候是已经安装的nginx ,升级增加nginx 模块功能. 最近公司要nginx增加一个可以播放 MP4的模块,安装还算顺利,不说废话上命令. 1 安装依赖 yum i ...

  7. Nginx安装、默认虚拟主机、Nginx用户认证、Nginx域名重定向

    12.6 Nginx安装 安装包下载到/usr/local/src目录 [root@taoyuan ~]# cd /usr/local/src [root@taoyuan src]# wget htt ...

  8. windows下nginx安装、配置与使用

    目前国内各大门户网站已经部署了Nginx,如新浪.网易.腾讯等:国内几个重要的视频分享网站也部署了Nginx,如六房间.酷6等.新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx ...

  9. Nginx安装、配置及使用总结

    版权声明:本文为博主原创文章,未经博主允许不得转载. Nginx的安装.配置及使用总结: Nginx是一个高性能的HTTP及反向代理服务器,也是IMAP/POP3/SMTP代理服务器.在高并发情况下, ...

  10. Centos 6.0/ Nginx 安装与配置

    系统:Centos 6.0 下载nginx(nginx-1.2.4.tar.g)   http://nginx.org/ 下载pcre(pcre-8.31.tar.gz)    http://pcre ...

最新文章

  1. UOJ.311.[UNR#2]积劳成疾(DP)
  2. 【转】tomcat性能调优
  3. 文件,文件夹基本操作
  4. Java中给循环体起别名
  5. Oracle GoldenGate OGG管理员手册(较早资料)
  6. MFC 学习笔记(一):MFC单文档程序运行流程梳理与总结
  7. 2.6 子窗口赋值给父窗口并关闭子窗口 我的程序猿之路:第十六章
  8. 荒野行动系统推荐观战榜_荒野行动如何进行观战 荒野行动观战系统使用详解...
  9. 因使用五年前的老旧代码,Azure 容器险遭黑客接管,微软已修复
  10. Shell 条件表达式的正则匹配
  11. 如何用gitbook写文档并存到github上
  12. java里当显式请求注释时才接受类名称
  13. 《Head First HTML and CSS 》中英文下载链接
  14. 黑苹果日记三(驱动)
  15. FSR402电阻式薄膜压力传感器
  16. 报错:信息:INFO: Error parsing HTTP request header
  17. 机器学习常用术语英语词汇
  18. 1小时赚300块,不打代码帮人做个吃鸡网页 [IVX实战第3篇]
  19. java多线程概念、实现、状态和生命周期、同步、通信
  20. MySQL:count(*) count(字段) 实现上区别

热门文章

  1. Atitit 知识图谱 RDF、RDFS和OWL数据模型 目录 1. 知识图谱 1 2. 二、知识图谱的前世今生 2 2.1. 五六十年代所提出的一种知识表示形式——语义网络(Semantic N
  2. Atitti v5住宿服务部后勤部建设指引指南.docx
  3. Atitit 编程语言常用算法attilax总结
  4. Atitit.biz业务系统 面向框架  面向模式---------数据映射imp
  5. atitit.基于虚拟机的启动器设计 --java 启动器 java生成exe
  6. 王健林:用深刻教训换来的8点心得
  7. ETF:一种让美国“80后”趋之若鹜的投资工具
  8. 量化研究: Julia还是Matlab?
  9. 在售后技术服务里,Kubernetes到底是什么? | 凌云时刻
  10. 计算机房选址,数据中心机房如何选址 数据中心机房如何日常维护