经过SSL Conf。返回“欢迎使用nginx!”

时间:2018-07-17 00:55:13

标签: django ssl nginx ubuntu-16.04

在这里,我确实浏览了之前的所有文章,但找不到适合我情况的任何东西。

我正在尝试在nginx上安装商业SSL证书。在为etc/nginx/sites-available/myapp配置以下内容之后:

server {
    listen 80;
    server_name example.come www.example.com;
    rewrite ^/(.*) https://example.com/$1 permanent;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/user/example.com;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/djangodeploy/example.com/rex.sock;
    }
}

server {
    listen 443 ssl;
    server_name example.com www.example.come;
    ssl_certificate /home/user/example.com.chained.crt;
    ssl_certificate_key /home/user/example.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GC$
    ssl_prefer_server_ciphers on;
}

检查语法后,一切都很好。 https可以很好地工作,但是它并没有提供实际的网站,而只是返回“欢迎使用nginx!”

我还在/etc/nginx/nginx.conf中将http指令配置为包括:

http {
      ssl_certificate /home/user/example.com.chained.crt;
      ssl_certificate_key /home/user/example.com.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: $
      ssl_prefer_server_ciphers on;

我听说gzip可能会引起问题,应该禁用它吗?

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

HTTPS服务器块不会代理到您的应用程序,因此您需要向其添加 // react import React, { Component } from 'react'; import { withStyles } from 'material-ui/styles'; // vendor import Grid from 'material-ui/Grid'; // source import LoginPage from 'components/pages/auth-page'; import BasePage from 'components/pages/base'; const styles = theme => ({ root: { display: "flex", height: "100%", [theme.breakpoints.down('sm')]: { width: "100%", }, [theme.breakpoints.up('md')]: { width: "80%", }, [theme.breakpoints.up('lg')]: { width: "70%", }, }, river: { display: "flex", marginTop: "75px", flexGrow: 1, justifyContent: "center", alignItems: "center", }, }); class Application extends Component { constructor(props){ super(props); } render(){ const { classes } = this.props; return( <div id={"root"} className={classes.root}> <Grid container className={classes.river}> {this.state.authorized ? <BasePage /> : <LoginPage /> } </Grid> </div> ) } } export default withStyles(styles)(Application); 块,最后是这样:

location /