Nginx Configure
1.主配置/etc/nginx.conf
#/etc/nginx/nginx.conf user nginx;
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"'; log_format main '[$time_iso8601] $remote_addr "$request" '
'$status $request_time $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; gzip on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_types *;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048; proxy_headers_hash_max_size 1024;
proxy_headers_hash_bucket_size 512;
server_names_hash_bucket_size 512; 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;
include /etc/nginx/vhosts/*.conf;
}
2.网站配置
# /etc/nginx/vhosts/my.domain.com.conf
server {
listen ;
server_name my.domain.com;
return https://$host$request_uri;
access_log /var/log/nginx/my.domain.com.access.log main;
error_log /var/log/nginx/my.domain.com.error.log;
location / {
proxy_pass http://localhost:3031/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
location /static/ {
alias /var/www/my.domain.com/static/;
autoindex off;
}
location /.well-known/ {
alias /var/www/my.domain.com/.well-known/;
autoindex off;
}
}
server {
listen ssl;
server_name my.domain.com;
access_log /var/log/nginx/my.domain.com.access.log main;
error_log /var/log/nginx/my.domain.com.error.log;
ssl_certificate "/root/.getssl/my.domain.com/my.domain.com.chain.crt";
ssl_certificate_key "/root/.getssl/my.domain.com/my.domain.com.key";
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 60m;
ssl_protocols TLSv1 TLSv1. TLSv1.;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
location / {
proxy_pass http://localhost:3031/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
# proxy pass php
location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /static/ {
alias /var/www/my.domain.com/static/;
autoindex off;
}
location /.well-known/ {
alias /var/www/my.domain.com/.well-known/;
autoindex off;
}
location ~* \.html$ {
root /var/www/my.domain.com/;
autoindex off;
}
location /robots.txt {
root /var/www/my.domain.com/;
autoindex off;
}
}
Nginx Configure的更多相关文章
- NGINX configure auto generator
NGINX configure auto generator The easiest way to configure a performant, secure, and stable NGINX s ...
- Nginx Configure时配置
Configure Arguments Configure arguments common for nginx binaries from pre-built packages for stable ...
- nginx configure fastdfs + SSL
./configure \ --prefix=/usr/local/nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ ...
- nginx configure参数
下面是nginx源码程序的configure参数: --prefix= 指向安装目录.默认为:/usr/local/nginx --sbin-path= 指定执行程序文件存放位置.默认为:prefix ...
- nginx configure 错误记录
1.the HTTP rewrite module requires the PCRE library. ./configure: error: the HTTP rewrite module req ...
- centos 7.0 安装nginx 1.9.10
可以参考以前安装成功的案例 centos 7.0 nginx 1.7.9成功安装过程 官网下载 http://nginx.org/en/download.html nginx下载位置 /usr/loc ...
- Nginx中文详解、配置部署及高并发优化
一.Nginx常用命令: 1. 启动 Nginx /usr/local/nginx/sbin/nginxpoechant@ubuntu:sudo ./sbin/nginx2. 停 ...
- ansible 初探nginx安装
我的配置: /etc/hosts: /etc/ansible/hosts: nglinx安装包: ansible自动化安装nginx: 1.安装ansible. 2.创建目录结构: mkdir -p ...
- centos6.4下安装php7+nginx+mariadb环境
一,安装php71,创建php用户和用户组,并在github下载php7源码#新建php用户和php组# groupadd -r php && useradd -r -g php -s ...
随机推荐
- Spring Cloud 是什么
概念定义 Spring Cloud 是一个服务治理平台,提供了一些服务框架.包含了:服务注册与发现.配置中心.消息中心 .负载均衡.数据监控等等. Spring Cloud 是一个微服务框架,相比 D ...
- Python左手画条龙右手画个彩虹
左手画龙右手画彩虹听说很火,Python也可以画出很美的彩虹,准确的说像彩虹棒棒糖:) 效果如下图: # -*- coding: utf-8 -*- # @Time : 2019/12/16 23:2 ...
- 微信小程序从开发至发布的流程
今天在公司将这几天开发的小程序,进行版本上线,在这里记录下. 首先,将微信开发工具里的代码上传到微信小程序平台里,如下所示 之后,在微信小程序平台进行审核提交,填写相应的信息即可,注意,审核提交分为紧 ...
- 7-43 jmu-python-字符串异常处理 (20 分)
输入一行字符串及下标,能取出相应字符.程序能对不合法数据做相应异常处理. 输入格式: 行1:输入一字符串 行2:输入字符下标 输出格式: 下标非数值异常,输出下标要整数 下标越界,输出下标越界 数据正 ...
- 什么是RPM
RPM是RedHat Package Manager(RedHat软件包管理工具)的缩写,这一文件格式名称虽然打上了RedHat的标志,但是其原始设计理念是开放式的,现在包括OpenLinux.S.u ...
- 基于osg的python三维程序开发(二)------向量
上一篇文章展示了如何简单创建一个osg python 程序, 本篇展示了了一些基础数据结构的使用: from pyosg import * vec = osg.Vec3Array() #push ba ...
- 01-初识InfluxDB
初识InfluxDB 1. InfluxDB介绍 时间序列数据库,简称时序数据库,Time Series Database,一个全新的领域,最大的特点就是每个条数据都带有Time列. 时序数据库到底能 ...
- QT使用信号量QSemaphore处理大量数据
实现如下:
- 如何查看子线程中的GC Alloc
1)如何查看子线程中的GC Alloc2)Build时,提示安卓NDK异常3)如何获得ParticleSystem产生的三角形数量4)关于图片通道的问题5)GPUSkinning导致模型动画不平滑 M ...
- 如何使用域名访问自己的Windows服务器(Java web 项目)
如何使用域名访问自己的Windows服务器(Java web 项目) 写在前面 前段时间在阿里云弄了个学生服务器,就想着自己搭建一个网站试一试,在网上查阅相关资料时发现大部分都是基于服务器是Linux ...