


FreeNAS 9のJail環境でWordpressを動作させる試みです
最終段階に入ってきました
今回はWebサーバ Nginxの設定です
Nginxは全くの初心者で書式がわからないのでサイトを徘徊してかき集めてきました
HTTPS サーバの設定
http://nginx.org/ja/docs/http/configuring_https_servers.html
時間のある時に勉強します
- nginx.confの作成
- 追加設定
- configtest
- Nginx起動
取り敢えずかき集めた情報で作成してみました。内容の半分も理解していませんので不具合があってもご容赦です
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
; html-script: false ] root@vhost:/root # vi /usr/local/etc/nginx/nginx.conf root@vhost:/root # cat /usr/local/etc/nginx/nginx.conf user www www; worker_processes 4; pid /var/run/nginx.pid; error_log /var/log/nginx.error_log info; events { worker_connections 1024; use kqueue; } #http section http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginxaccess.log main; sendfile on; keepalive_timeout 65; gzip on; server_names_hash_bucket_size 64; gzip_http_version 1.1; gzip_vary on; gzip_comp_level 1; gzip_min_length 1100; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript text/x$ gzip_buffers 16 8k; gzip_disable "MSIE [1-6].(?!.*SV1)"; server { listen 80; server_name www2.rootlinks.net; root /usr/local/www/wordpress; index index.php index.html index.htm; location / { # If requested URI does not match any existing file, directory or symbolic link, rewrite the URL to index.php if (!-e $request_filename) { rewrite ^ /index.php last; } } # For all PHP requests, pass them on to PHP-FPM via FastCGI location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include fastcgi_params; # include extra FCGI params } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; log_not_found off; expires max; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/www/nginx-dist; } } } |
諸々の設定を行います
1 2 3 4 5 6 7 8 |
; html-script: false ] root@vhost:/root # chown -R www:www /usr/local/www/wordpress/ root@vhost:/root # cp /usr/local/etc/nginx/mime.types-dist /usr/local/etc/nginx/mime.types root@vhost:/root # cp /usr/local/etc/nginx/fastcgi_params-dist /usr/local/etc/nginx/fastcgi_params root@vhost:/root # touch /var/log/nginx_access.log |
Nginxを起動する前に念の為に設定ファイルの文法チェックを行います
ここでエラーが表示された場合はエラー内容を確認して修正して下さい
1 2 3 4 5 |
; html-script: false ] root@vhost:/root # /usr/local/etc/rc.d/nginx configtest Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful |
1 2 3 4 5 6 |
; html-script: false ] root@vhost:/root # /usr/local/etc/rc.d/nginx start Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Starting nginx. |