質問編集履歴
8
nano etc/nginx/nginx.conf
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,71 @@
|
|
1
|
+
追記 nano etc/nginx/nginx.conf
|
2
|
+
|
3
|
+
```ここに言語を入力
|
4
|
+
# For more information on configuration, see:
|
5
|
+
# * Official English Documentation: http://nginx.org/en/docs/
|
6
|
+
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
7
|
+
|
8
|
+
user nginx;
|
9
|
+
worker_processes auto;
|
10
|
+
error_log /var/log/nginx/error.log;
|
11
|
+
pid /run/nginx.pid;
|
12
|
+
|
13
|
+
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
|
14
|
+
include /usr/share/nginx/modules/*.conf;
|
15
|
+
|
16
|
+
events {
|
17
|
+
worker_connections 1024;
|
18
|
+
}
|
19
|
+
|
20
|
+
http {
|
21
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
22
|
+
'$status $body_bytes_sent "$http_referer" '
|
23
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
24
|
+
|
25
|
+
access_log /var/log/nginx/access.log main;
|
26
|
+
|
27
|
+
sendfile on;
|
28
|
+
tcp_nopush on;
|
29
|
+
tcp_nodelay on;
|
30
|
+
keepalive_timeout 65;
|
31
|
+
types_hash_max_size 2048;
|
32
|
+
|
33
|
+
include /etc/nginx/mime.types;
|
34
|
+
default_type application/octet-stream;
|
35
|
+
|
36
|
+
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
37
|
+
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
38
|
+
# for more information.
|
39
|
+
include /etc/nginx/conf.d/*.conf;
|
40
|
+
|
41
|
+
server {
|
42
|
+
listen 80 default_server;
|
43
|
+
listen [::]:80 default_server;
|
44
|
+
server_name _;
|
45
|
+
root /usr/share/nginx/html;
|
46
|
+
|
47
|
+
# Load configuration files for the default server block.
|
48
|
+
include /etc/nginx/default.d/*.conf;
|
49
|
+
|
50
|
+
location / {
|
51
|
+
}
|
52
|
+
|
53
|
+
error_page 404 /404.html;
|
54
|
+
location = /40x.html {
|
55
|
+
}
|
56
|
+
|
57
|
+
error_page 500 502 503 504 /50x.html;
|
58
|
+
location = /50x.html {
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
|
1
69
|
環境については後述させて頂きますがまず要所を説明します。宜しくお願い致します。
|
2
70
|
|
3
71
|
### 前提・実現したいこと
|
7
sudo nano /etc/nginx/conf.d/gunicorn.conf
title
CHANGED
File without changes
|
body
CHANGED
@@ -76,4 +76,21 @@
|
|
76
76
|
rich rules:
|
77
77
|
```
|
78
78
|
|
79
|
+
gunicornの中には以下のように設定しております。
|
80
|
+
|
81
|
+
sudo nano /etc/nginx/conf.d/gunicorn.conf
|
82
|
+
|
83
|
+
```ここに言語を入力
|
84
|
+
server {
|
85
|
+
listen 80;
|
86
|
+
server_name 1.2.3.4;
|
87
|
+
location / {
|
88
|
+
proxy_pass ; http://1.2.3.4:8080
|
89
|
+
proxy_set_header Host $http_host;
|
90
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
```
|
94
|
+
|
95
|
+
|
79
96
|
宜しくお願いします。
|
6
sudo firewall-cmd --list-all の結果を通知
title
CHANGED
File without changes
|
body
CHANGED
@@ -56,4 +56,24 @@
|
|
56
56
|
ListenAddress 0.0.0.0
|
57
57
|
#ListenAddress ::
|
58
58
|
```
|
59
|
+
sudo firewall-cmd --list-all を打ちましたが8080は許可しています。
|
60
|
+
|
61
|
+
```ここに言語を入力
|
62
|
+
|
63
|
+
|
64
|
+
public (active)
|
65
|
+
target: default
|
66
|
+
icmp-block-inversion: no
|
67
|
+
interfaces: eth0
|
68
|
+
sources:
|
69
|
+
services: dhcpv6-client http https ssh
|
70
|
+
ports: 443/tcp 8000/tcp 8080/tcp
|
71
|
+
protocols:
|
72
|
+
masquerade: no
|
73
|
+
forward-ports:
|
74
|
+
source-ports:
|
75
|
+
icmp-blocks:
|
76
|
+
rich rules:
|
77
|
+
```
|
78
|
+
|
59
79
|
宜しくお願いします。
|
5
ポート番号設置内容
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,4 +42,18 @@
|
|
42
42
|
ftp CNAME @
|
43
43
|
※みえずらくてすみません
|
44
44
|
|
45
|
+
nano /etc/ssh/sshd_config
|
46
|
+
|
47
|
+
の中にあるポート番号は以下のように設置しております。
|
48
|
+
|
49
|
+
```ここに言語を入力
|
50
|
+
# If you want to change the port on a SELinux system, you have to tell
|
51
|
+
# SELinux about this change.
|
52
|
+
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
|
53
|
+
|
54
|
+
Port 25252
|
55
|
+
#AddressFamily any
|
56
|
+
ListenAddress 0.0.0.0
|
57
|
+
#ListenAddress ::
|
58
|
+
```
|
45
59
|
宜しくお願いします。
|
4
不要文字の削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
### 前提・実現したいこと
|
4
4
|
|
5
5
|
djangoアプリを開発中です。
|
6
|
-
http://example.com/ というドメイン名をIPと紐づけて表示させたいです。
|
6
|
+
http://example.com/ というドメイン名をIPと紐づけて表示させたいです。
|
7
7
|
|
8
8
|
### 発生している問題
|
9
9
|
|
3
http://example.comに修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
http://
|
1
|
+
http://example.com:8080/ の :8080 を削除してIPの中身を表示させたい
|
body
CHANGED
@@ -3,27 +3,27 @@
|
|
3
3
|
### 前提・実現したいこと
|
4
4
|
|
5
5
|
djangoアプリを開発中です。
|
6
|
-
http://
|
6
|
+
http://example.com/ というドメイン名をIPと紐づけて表示させたいです。xxxは仮名
|
7
7
|
|
8
8
|
### 発生している問題
|
9
9
|
|
10
|
-
現在 http://
|
10
|
+
現在 http://example.com:8080/ というURLを打つと
|
11
11
|
1.2.3.4 というIPアドレス上の内容が表示されます。
|
12
12
|
1.2.3.4には既にdjangoをnginxで設置しています。
|
13
13
|
|
14
14
|
しかし
|
15
|
-
http://
|
15
|
+
http://example.com/ という風に「:8080」を抜いたドメインだけのURLを叩くと
|
16
16
|
以下のようにcentosの画面が表示されてしまい1.2.3.4の内容が表示されません。
|
17
17
|
|
18
|
-
通常は
|
18
|
+
通常はhttp://example.com/のようにブラウザ上で表示させる事が多いですよね。
|
19
|
-
その場合つまりhttp://
|
19
|
+
その場合つまりhttp://example.com/とした場合以下のように表示されます。
|
20
20
|
SSLは次の段階として今は除外しております。
|
21
21
|
|
22
22
|

|
23
23
|
|
24
24
|
### やりたいことを一文で
|
25
25
|
つまり
|
26
|
-
http://
|
26
|
+
http://example.com/ のURLを叩いて
|
27
27
|
1.2.3.4 というIPアドレス上の内容を表示させたいです。
|
28
28
|
|
29
29
|
### 補足情報(FW/ツールのバージョンなど)
|
2
わかりやすく説明変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,9 +12,13 @@
|
|
12
12
|
1.2.3.4には既にdjangoをnginxで設置しています。
|
13
13
|
|
14
14
|
しかし
|
15
|
-
http://xxx.com/ だけのURLを叩くと
|
15
|
+
http://xxx.com/ という風に「:8080」を抜いたドメインだけのURLを叩くと
|
16
16
|
以下のようにcentosの画面が表示されてしまい1.2.3.4の内容が表示されません。
|
17
17
|
|
18
|
+
通常はxxx.comのようにブラウザ上で表示させる事が多いですよね。
|
19
|
+
その場合つまりhttp://xxx.comとした場合以下のように表示されます。
|
20
|
+
SSLは次の段階として今は除外しております。
|
21
|
+
|
18
22
|

|
19
23
|
|
20
24
|
### やりたいことを一文で
|
1
ご指摘頂いた部分について修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
http://xxx.com
|
1
|
+
http://xxx.com:8080 の :8080 を削除してIPの中身を表示させたい
|
body
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
### 発生している問題
|
9
9
|
|
10
|
-
現在 http://xxx.com
|
10
|
+
現在 http://xxx.com:8080 というURLを打つと
|
11
11
|
1.2.3.4 というIPアドレス上の内容が表示されます。
|
12
12
|
1.2.3.4には既にdjangoをnginxで設置しています。
|
13
13
|
|