req: 配置参数-x509指定使用 X.509证书签名请求管理(certificate signing request (CSR)).”X.509” 是一个公钥代表that SSL and TLS adheres to for its key and certificate management. -nodes: 告诉OpenSSL生产证书时忽略密码环节.(因为我们需要Nginx自动读取这个文件,而不是以用户交互的形式)。 -days 36500: 证书有效期,100年 -newkey rsa:2048: 同时产生一个新证书和一个新的SSL key(加密强度为RSA 2048) -keyout:SSL输出文件名 -out:证书生成文件名 它会问一些问题。需要注意的是在common name中填入网站域名,如wiki.xby1993.net即可生成该站点的证书,同时也可以使用泛域名如*.xby1993.net来生成所有二级域名可用的网站证书。 整个问题应该如下所示:
Country Name (2 letter code) [AU]:US State or Province Name (fullname) [Some-State]:New York Locality Name (eg, city) []:New York City Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bouncy Castles, Inc. Organizational Unit Name (eg, section) []:Ministry of Water Slides Common Name (e.g. server FQDN or YOUR name) []:your_domain.com Email Address []:admin@your_domain.com
步骤2: 修改Nginx配置
server { listen80; listen443 ssl; ssl_certificate"/Users/chrischen/server/nginx/nginx.crt"; ssl_certificate_key"/Users/chrischen/server/nginx/nginx.key"; server_name"wui-test.local.aidalan.com"; server_name"test-wui.local.aidalan.com";
root"/Users/chrischen/dalan/wui-test.local.aidalan.com"; index index.html index.htm;
#!/bin/bash # Author: Matt Mastracci ([email protected]) # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script # licensed under cc-wiki with attribution required # Remainder of script public domain osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` else FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else cd"$FILE" /usr/local/bin/rz -E -e -b sleep 1 echo echo echo \# Sent \-\> $FILE fi
iterm2-send-zmodem.sh
#!/bin/bash # Author: Matt Mastracci ([email protected]) # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script # licensed under cc-wiki with attribution required # Remainder of script public domain osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` else FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else /usr/local/bin/sz "$FILE" -e -b sleep 1 echo echo \# Received $FILE fi