Skip to content

Instantly share code, notes, and snippets.

View pandanote-info's full-sized avatar

pandanote-info pandanote-info

View GitHub Profile
@pandanote-info
pandanote-info / nginx_growi.conf.example
Last active February 18, 2022 01:14
nginxでHTTPS接続のリクエストを受け付けて、GROWIに転送するためのnginxの設定例。
# ドル記号の前のバックスラッシュはpanda大学習帳(https://pandanote.info/)での表示用のものです。
# nginxの設定として使用する場合には、ドル記号の前のスラッシュは削除が必要です。
http {
(中略)
map \$remote_addr \$allowed {
~aa.bb.cc. allow;
~2aaa:bbbb:cccc:dd: allow;
pp.qqq.rr.s allow;
127.0.0.1 allow;
default deny;
@pandanote-info
pandanote-info / startgrowi.sh
Created January 12, 2020 00:50
GROWI起動用のスクリプト(Fedora 31用)。
#!/bin/bash
cd /opt/wiki/growi
npm run server:prod
@pandanote-info
pandanote-info / env.prod.js
Last active March 26, 2021 14:05
リソースが少ないサーバのためのenv.prod.jsの設定例(Fedora 31用)。
module.exports = {
NODE_ENV: 'production',
// FORMAT_NODE_LOG: false,
NODE_OPTIONS: '--max_old_space_size=768',
MATHJAX: 1
};
@pandanote-info
pandanote-info / growi.service
Created January 12, 2020 00:37
GROWIを起動するためのサービスのユニット定義ファイル(Fedora 31用)。
[Unit]
Description=Growi
After=network.target mongod.service
[Service]
WorkingDirectory=/opt/wiki/growi
EnvironmentFile=/etc/sysconfig/growi
ExecStart=/bin/bash /opt/wiki/startgrowi.sh
[Install]
WantedBy=multi-user.target
@pandanote-info
pandanote-info / growi
Last active March 26, 2021 14:08
GROWIの設定用ファイル(Fedora 31用)。/etc/sysconfigの下に置いて使用する。
PORT=3000
MODE_ENV=production
PASSWORD_SEED="openssl rand -base64 128 | head -1`"
MONGO_URI="mongodb://localhost:27017/growi"
FILE_UPLOAD=local
MATHJAX=1
@pandanote-info
pandanote-info / mongodb-org.repo
Created January 11, 2020 13:57
MongoDBのリポジトリ定義用のファイル(Fedora 31用)。
[mongodb-org]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
@pandanote-info
pandanote-info / nginx_customized_404.conf
Created January 4, 2020 14:43
Wordpressで用意した404.phpを表示させるためのnginx.confの設定
http {
(略)
server {
(略)
error_page 404 = @notfound;
location @notfound {
root (Apache httpdでDocumentRootとして設定していた値);
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SERVER_NAME $host;
@pandanote-info
pandanote-info / nginx_server_http_user_agent_example.conf
Created January 4, 2020 14:09
特定のhttp_user_agent変数を設定する端末からのアクセスを無条件で許可するためのnginx.confの設定例。
http {
(略)
server {
(略)
location /somewhere_to_restrict {
(前略)
if ($http_user_agent ~ WhileMobile) {
return 404;
}
(中略)
@pandanote-info
pandanote-info / nginx_server_map_example_part2.conf
Created January 4, 2020 14:04
mapを使ったIPアドレスによるアクセスコントロールリストの設定例(その2)。
http {
(略)
server {
(略)
location /somewhere_to_restrict {
(前略)
if ($allowed = deny) {
return 404;
}
(後略)
@pandanote-info
pandanote-info / nginx_server_map_example.conf
Last active January 4, 2020 14:01
mapを使ったIPアドレスによるアクセスコントロールリストの設定例(その1)。
http {
(前略)
map {
ab.cd.ef.ghi allow;
~2abc:defg:hijk:lmop: allow;
default deny;
}
(後略)
}