linux:nginx
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
linux:nginx [2014/07/11 01:52] – external edit 127.0.0.1 | linux:nginx [2014/11/27 05:57] – [Enable php] percy | ||
---|---|---|---|
Line 70: | Line 70: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== nginx all https ===== | ||
+ | To enable redirect all the http request to https | ||
+ | rewrite ^(.*) https:// | ||
+ | | ||
+ | ==== generate the ssl certificate ==== | ||
+ | |||
+ | mkdir / | ||
+ | sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout / | ||
+ | |||
+ | |||
+ | <code file=proxy.pjq.me.conf> | ||
+ | server { | ||
+ | listen 80; | ||
+ | root / | ||
+ | index index.html index.htm index.php; | ||
+ | server_name | ||
+ | rewrite ^(.*) https:// | ||
+ | location / { | ||
+ | try_files $uri $uri/ =404; | ||
+ | autoindex on; | ||
+ | } | ||
+ | location ~ \.php$ { | ||
+ | fastcgi_split_path_info ^(.+\.php)(/ | ||
+ | fastcgi_pass unix:/ | ||
+ | fastcgi_index index.php; | ||
+ | include fastcgi_params; | ||
+ | } | ||
+ | } | ||
+ | server { | ||
+ | listen 443 ssl; | ||
+ | root / | ||
+ | index index.html index.htm index.php; | ||
+ | server_name | ||
+ | ssl_certificate / | ||
+ | ssl_certificate_key / | ||
+ | location / { | ||
+ | try_files $uri $uri/ =404; | ||
+ | autoindex on; | ||
+ | } | ||
+ | location ~ \.php$ { | ||
+ | fastcgi_split_path_info ^(.+\.php)(/ | ||
+ | fastcgi_pass unix:/ | ||
+ | fastcgi_index index.php; | ||
+ | include fastcgi_params; | ||
+ | } | ||
+ | } | ||
</ | </ | ||
/var/www/dokuwiki/wiki/data/pages/linux/nginx.txt · Last modified: 2016/05/05 13:07 by 127.0.0.1