ini 用于dockerized wordpress的nginx.conf

用于dockerized wordpress的nginx.conf

nginx.conf
worker_processes 1;

events { 
    worker_connections 1024;
    multi_accept on;
}

http {
  
    sendfile on;
    tcp_nopush on;
    
    index index.php index.html;
    
    client_body_timeout     12;
    client_header_timeout   12;
    keepalive_timeout       15;
    send_timeout            10;
    
    # Types
    include         /etc/nginx/mime.types;
    default_type    application/octet-stream;

    gzip on;
    gzip_disable "msie6";
    
    gzip_vary on;
    gzip_comp_level 3;
    gzip_types 
        text/plain text/css application/json 
        application/x-javascript text/xml 
        application/xml application/xml+rss text/javascript;

    server {
    
        listen      443 ssl http2;
        listen [::]:443 ssl http2;
        
        server_name your.domain.com;
        
        root /var/www/html;
    
        add_header                Strict-Transport-Security "max-age=31536000" always;
    
        ssl_session_timeout       10m;
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
    
        ssl_stapling              on;
        ssl_stapling_verify       on;
        resolver                  8.8.8.8 8.8.4.4;
    
        ssl_certificate           /etc/letsencrypt/live/your.domain.com/fullchain.pem;
        ssl_certificate_key       /etc/letsencrypt/live/your.domain.com/privkey.pem;
        ssl_trusted_certificate   /etc/letsencrypt/live/your.domain.com/chain.pem;

    	# Basic Settings
    
    	client_max_body_size 64M;
        
        location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
        }
        
        location ~ \.php$ {
            try_files $uri =404;
            include fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass wordpress:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        }
        
        # allow Let's Encrypt access to the .well-known folder
        location ^~ /.well-known {
            allow all;
            root /data/letsencrypt/;
        }
        location = /favicon.ico {
            access_log off;
            log_not_found off;
            expires max;
        }
        location = /robots.txt {
            access_log off;
            log_not_found off;
        }
        
        # Security Settings For Better Privacy Deny Hidden Files
        location ~ /\. {
            deny all;
            access_log off;
            log_not_found off;
        }
        
        # Disallow PHP In Upload Folder
        location /wp-content/uploads/ {
            location ~ \.php$ {
                deny all;
            }
        }

    }
}

ini Seafile Nginx配置文件

基于泊坞窗的seafile的nginx的配置文件

seafile.conf
upstream advert {
    server localhost:10001 fail_timeout=0;
}
upstream seafhttp {
    server localhost:10002 fail_timeout=0;
}


server {
    listen       8080;
    server_name  192.168.1.192;

    location / {
        if (!-f $request_filename) {
            proxy_pass http://advert;
            break;
        }
    }

}


server {
    listen       80;
    server_name  192.168.1.192;

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:10002;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
    }
}

ini Postgres - 配置优化

pstgresql.conf
max_connections = 200
shared_buffers = 16GB
effective_cache_size = 48GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 13981kB
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 12
max_parallel_workers_per_gather = 6

ini [Senaite LIMS] Plone配置文件#plone #config #senaite #lims

[Senaite LIMS] Plone配置文件#plone #config #senaite #lims

buildout.cfg
############################################
#
# Buildout Configuration File for Plone
# -------------------------------------
#
# ALWAYS back up all Plone/Zope data and components
# before changing configuration.
#
# Running "bin/buildout" will update your installation,
# installing missing components as necessary.
#
# This will update the add-on products you've added in the eggs= lines.
# This will not, however, upgrade Plone itself (or anything else you've
# pinned with a version specification). To upgrade Plone itself, see the
# comments in "Plone Component Versions".
#
# Tutorial instructions for using zc.buildout for
# configuration management are available at:
# http://plone.org/documentation/tutorial/buildout
# Full details at http://pypi.python.org/pypi/zc.buildout
#
############################################

[buildout]

###### ADDITION ######
index = https://pypi.python.org/simple
######################

############################################
# Plone Component Versions
# ------------------------
# This version of the Unified Installer has the components of Plone 4
# preloaded so that it can install without an Internet connection.
# If you want to update, uncomment the "http://..." line below,
# edit it to point to the current version URL, comment out the
# "versions.cfg" line and run "bin/buildout" while attached to the
# Internet. Generally, you only want to do that as part of a planned migration.
# Note that if you are updating components, you should also check the versions
# section at the end of this file, since recipes or components other than
# those of Zope and Plone may need updating at the same time.
#
extends =
    base.cfg
    versions.cfg
#    http://dist.plone.org/release/4.3.15/versions.cfg

###### ADDITION ############
# Upgraded to Plone 4.3.15 #
############################

# If you change your Plone version, you'll also need to update
# the repository link below.
find-links +=
    http://dist.plone.org/release/4.3.15

# If you try to start Zope as root, it will change user id to run as
# the effective user specified here. This user id must own the var directory
# of your buildout.
effective-user = jhorsager
# This user will own the rest of the installation, and should be used to
# run buildout.
buildout-user = jhorsager
# A flag to tell the Unified Installer whether or not to document sudo use.
need-sudo = no

############################################
# Eggs
# ----
# Add an indented line to the eggs section for any Python
# eggs or packages you wish to include in your Plone instance.
#
# Note that versions may be specified here or in the [versions]
# section below. You should always specify versions that you know
# are compatible with the Plone release and at an acceptable
# development level.
#
# If you update to a later version of Plone, remove the hotfix.
#
eggs =
    Plone
    Pillow
###### ADDITION ######
    senaite.lims
######################

############################################
# ZCML Slugs
# ----------
# Some eggs need ZCML slugs to tell Zope to
# use them. This is increasingly rare.
zcml =
#    plone.reload

############################################
# Development Eggs
# ----------------
# You can use paster to create "development eggs" to
# develop new products/themes. Put these in the src/
# directory.
# You will also need to add the egg names in the
# eggs section above, and may also need to add them
# to the zcml section.
#
# Provide the *paths* to the eggs you are developing here:
develop =
#    src/my.package

############################################
# var Directory
# -------------
# Sets the target directory for the "var" components of the install such as
# database and log files.
#
var-dir=${buildout:directory}/var

############################################
# Backup Directory
# ----------------
# Sets the target directory for the bin/backup and bin/snapshotbackup
# commands. Default is inside this project's var directory, but ideally
# this should be on a separate volume or backup server.
#
backups-dir=${buildout:var-dir}

############################################
# Initial User
# ------------
# This is the user id and password that will be used to create the initial
# user id that will allow you to log in and create a Plone site. This only
# sets the initial password; it will not allow you to change an already
# existing password. If you change the admin password via the web interface,
# the one below will no longer be valid.
# If you find yourself locked out of your Zope/Python installation, you may
# add an emergency user via "bin/plonectl adduser".
user=admin:passwd

############################################
# Debug Options
# -------------
# Start Zope/Plone instances in "fg" mode to turn on debug mode;
# this will dramatically slow Plone.
#
# Add-on developers should turn deprecation warnings on
deprecation-warnings = off
# change verbose-security to "on" for useful security errors while developing
verbose-security = off

############################################
# Parts Specification
#--------------------
# Specifies the components that should be included in the buildout.
# Most are defined in the base.cfg extension; you may add your
# own if you need them at the end of this file.
parts =
    instance
    repozo
    backup
    zopepy
    unifiedinstaller

############################################
# Major Parts
# ----------------------
# These common parts make use of sane base settings from
# base.cfg. To customize a part, just add whatever options
# you need. Read base.cfg for common settings.

[instance]
<= instance_base
recipe = plone.recipe.zope2instance
http-address = 8080


############################################
# Versions Specification
# ----------------------
# Version information supplied here will "pin" Python packages to a particular
# version number, even when you use the "newest" flag running buildout.
# Specifying versions for all packages is a good idea and can prevent
# accidental changes when you add new packages to your buildout.
# Note that versions specified here will override those specified earlier
# in the configuration, including those from the Plone and Zope version
# config files.
#
[versions]
zc.buildout = 2.5.3
setuptools = 27.3.0
Pillow = 4.1.0

MarkupSafe = 1.0
Products.DocFinderTab = 1.0.5
bobtemplates.plone = 1.0.5
buildout.sanitycheck = 1.0.2
collective.checkdocs = 0.2
collective.recipe.backup = 3.1
mr.bob = 0.1.2
pkginfo = 1.4.1
plone.recipe.unifiedinstaller = 4.3.2
requests = 2.13.0
requests-toolbelt = 0.7.1
twine = 1.8.1
zest.pocompile = 1.4

# Required by:
# Pillow==4.1.0
olefile = 0.44

# Required by:
# clint==0.5.1
args = 0.1.0

# Required by:
# twine==1.8.1
clint = 0.5.1

# Required by:
# zest.releaser==6.6.2
colorama = 0.3.8

ini 多站点基岩修复网址

多站点基岩修复网址

nginx.conf
if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp/$1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp/$1 last;
}

ini tmux conf

tmux conf

.tmux.conf
# bind C-a
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
# mouse
set -g mouse on
# color
set -g status-style "bg=#00346e, fg=#ffffd7"

ini php.ini中

php
memory=20MB;

memory_limit = 164M
upload_max_filesize = 100M
post_max_size = 100M
max_input_vars = 5000

ini .tmux.conf

.tmux.conf
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix 'C-\'
bind-key 'C-\' send-prefix

# split panes using = and -
bind i split-window -h
bind s split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
bind h resize-pane -L 5
bind j resize-pane -D 5
bind k resize-pane -U 5
bind l resize-pane  -R 5
unbind Left
unbind Down
unbind Up
unbind Right

unbind M-Left
unbind M-Right
unbind S-Left
unbind S-Right
bind -n M-Left previous-window
bind -n M-Right next-window

# Enable mouse control (clickable windows, panes, resizable panes)
# setw -g mode-mouse on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
# set -g mouse-select-window on
# for tmux 2.3
setw -g mouse on
setw -g monitor-activity on
set -g default-terminal "screen-256color"

# automatically set window title
setw -g automatic-rename on
set -g set-titles on
# don't rename windows automatically
# set-option -g allow-rename off

# # enable activity alerts
# set -g visual-activity on
#
# Center the window list
set -g status-justify centre
set -g status-keys vi
setw -g mode-keys vi

bind -n M-i setw synchronize-panes

bind r source-file ~/.tmux.conf
source-file "${HOME}/.tmux-themepack/powerline/block/orange.tmuxtheme"

set -sg escape-time 0

bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ;   bind-key -T copy-mode-vi v send-keys -X begin-selection
# unbind-key -T copy-mode-vi Enter ;   bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# unbind-key -T copy-mode-vi Enter ;   bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
# unbind-key -T copy-mode-vi C-v   ;   bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
# unbind-key -T copy-mode-vi [     ;   bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ]     ;   bind-key -T copy-mode-vi ] send-keys -X copy-selection
unbind-key -T copy-mode-vi Enter ;   bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard"

ini Modsecurity规则修复Wordpress

添加到/usr/local/apache/conf/modsec2/exclude.conf

exclude.conf
<locationmatch "/wp-admin/admin-ajax.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>

<locationmatch "/wp-admin/page.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>

<locationmatch "/wp-admin/post.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>

ini [nginx conf] nginx简易转发配置#nginx

[nginx conf] nginx简易转发配置#nginx

localhost.conf
server {
  listen       80;
  server_name  localhost www.test.cn;

  proxy_connect_timeout 30s;
  proxy_read_timeout 1000s;

  location / {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-real-ip $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:8080;
  }
}