老师,重启nginx最后两步出现异常,应该是哪方面问题呢?

来源:17-7 uwsgi和nginx配置

慕侠3297407

2021-10-05

Xshell 7 (Build 0085)
Copyright © 2020 NetSarang Computer, Inc. All rights reserved.

Type `help’ to learn how to use Xshell prompt.
[C:~]$

Connecting to 39.105.208.151:22…
Connection established.
To escape to local shell, press ‘Ctrl+Alt+]’.

WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Tue Oct 5 01:23:28 2021 from 119.186.75.31

Welcome to Alibaba Cloud Elastic Compute Service !

[root@iZ2ze17576m2eqmvvfsbq0Z ~]# ls
ashang Python-3.7.3.tgz
[root@iZ2ze17576m2eqmvvfsbq0Z ~]# cd ashang/
[root@iZ2ze17576m2eqmvvfsbq0Z ashang]# ls
apps ashang conf manage.py requirements.txt static templates xadmin
[root@iZ2ze17576m2eqmvvfsbq0Z ashang]# cd conf
[root@iZ2ze17576m2eqmvvfsbq0Z conf]# ls
nginx uwsgi
[root@iZ2ze17576m2eqmvvfsbq0Z conf]# cd nginx/
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# ls
uc_nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# cp uc_nginx.conf /etc/nginx/conf.d/
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# ls /etc/nginx/conf.d/
uc_nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# vim /etc/nginx/
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# vim /etc/nginx/
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# vim /etc/nginx/nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# ps aux|grep nginx
root 379 0.0 0.1 112708 984 pts/2 S+ 02:34 0:00 grep --color=auto nginx
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# ls /etc/nginx/conf.d/
uc_nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# vim /etc/nginx/
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# ls
uc_nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# /etc/nginx/
-bash: /etc/nginx/: Is a directory
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# vim /etc/nginx/nginx.conf
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[root@iZ2ze17576m2eqmvvfsbq0Z nginx]# sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.

写回答

3回答

慕侠3297407

提问者

2021-10-05

//img.mukewang.com/szimg/615c69b909e3af1011860955.jpg

//img.mukewang.com/szimg/615c69b909670d8114851024.jpg

有红线提示

0
4
慕侠3297407
已解决
2021-10-22
共4条回复

慕侠3297407

提问者

2021-10-05


# 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/doc/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 4096;


    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;

        listen       [::]:80;

        server_name  _;

"/etc/nginx/nginx.conf" 84L, 2335C     


0
0

慕侠3297407

提问者

2021-10-05

[root@iZ2ze17576m2eqmvvfsbq0Z ~]# nginx -t

nginx: [emerg] unknown directive "alias/root/ashang/media" in /etc/nginx/conf.d/uc_nginx.conf:20

nginx: configuration file /etc/nginx/nginx.conf test failed

[root@iZ2ze17576m2eqmvvfsbq0Z ~]# nginx -tc /etc/nginx/nginx.conf

nginx: [emerg] unknown directive "alias/root/ashang/media" in /etc/nginx/conf.d/uc_nginx.conf:20

nginx: configuration file /etc/nginx/nginx.conf test failed

[root@iZ2ze17576m2eqmvvfsbq0Z ~]# 


0
4
慕侠3297407
回复
bobby
# the upstream component nginx needs to connect to upstream django { # server unix:///path/to/your/mysite/mysite.sock; # for a file socket server 127.0.0.1:8000; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 80; # the domain name it will serve for server_name 39.105.208.151; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias/root/ashang/media; # 指向django的media目录 } location /static { alias/root/ashang/static; # 指向django的static目录 } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include uwsgi_params; # the uwsgi_params file you installed } }
2021-10-05
共4条回复

Django+ xadmin 开发在线教育网站

一套通用的技术组合拳,助你解决大部分Python类网站后端问题

1911 学习 · 2149 问题

查看课程