nginx基本操作安装:yuminstallnginxstart:servicenginxstartstop:servicenginxstopreload:servicenginxreloaddeployNGINX://$sudoservicehttpdstop$sudoyuminstallnginx检查是否启动:$ps-ef|grepnginxstart:$sudoservicenginxstart$sudoservicenginxreloadfirewall-cmd--zone=public--add-port=80/tcp--永久防火墙开放80端口firewall-cmd--reloadfirewallreloadyuminstalliptables-servicessystemctlenableiptablessystemctlstopfirewalldsystemctlstartfirewalld配置/etc/nginx/下的配置文件:因为在nginx主配置文件中引入了conf.d文件夹:include/etc/nginx/conf.d/*.conf;所以在nginx/conf.d/下添加qingyun.conf文件进行配置。主要配置文件如下:#更多配置信息参见:#*英文官方文档:http://nginx.org/en/docs/#*俄文官方文档:http://nginx.org/ru/docs/用户根;worker_processes自动;错误日志/var/log/nginx/error.log;pid/run/nginx.pid;#加载动态模块。参见/usr/share/nginx/README.dynamic.include/usr/share/nginx/模块/*.conf;事件{worker_connections1024;}http{log_formatmain'$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.logmain;发送文件;tcp_nopush上;tcp_nodelayon;keepalive_timeout65;types_hash_max_size2048;包括/etc/nginx/mime.types;default_type应用程序/八位字节流;#从/etc/nginx/conf.d目录加载模块化配置文件。#有关详细信息,请参阅http://nginx.org/en/docs/ngx_core_module.html#include#。包括/etc/nginx/conf.d/*.conf;服务器{听80default_server;听[::]:80默认服务器;服务器名称_;根/usr/share/nginx/html;#加载默认服务器块的配置文件。包括/etc/nginx/default.d/*.conf;位置/{}error_page404/404.html;位置=/40x。html{}error_page500502503504/50x.html;location=/50x.html{}}}首先是主配置文件,修改用户组userroot;2.然后运行:cdconf.dtouchabcdefg.conf//NewFilevimabcdefg.confmodifyabcdefg.conf:server{listen80;服务器名称**。**。***。**;#charsetkoi8-r;#access_log日志/host.access.logmain;位置/{root/home/******/******;indexindex.htmlindex.htm;try_files$uri/index.html;}#error_page404/404.html;#将服务器错误页面重定向到静态页面/50x.html#error_page500502503504/50x.html;位置=/50x。html{根html;react-router在nginx上的应用,参考:Adjustnginxtoservereact-routerapplicationcorrectly注意unrarebuild.rarbuild会在linux解压文件时makebuild.rar中的所有文件解压到build文件夹,不要保留原目录unrarxbuild.rarbuild解压后会保留原目录。
