add nginx.conf
This commit is contained in:
parent
9e5c1f27f7
commit
1243a39bab
|
@ -0,0 +1,142 @@
|
|||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
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 logs/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
|
||||
#access_log logs/host.access.log main;
|
||||
|
||||
location / {
|
||||
root html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#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 html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
# ref http://askubuntu.com/questions/134666/what-is-the-easiest-way-to-enable-php-on-nginx
|
||||
# start php5 sudo service php5-fpm restart
|
||||
location ~ \.php$ {
|
||||
root html;
|
||||
# fastcgi_pass 127.0.0.1:9000; # ubuntu old
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock; # ubuntu 12.10 or newer
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
|
||||
# 服务器状态信息监控,需要编译时开启--with-http_stub_status_module模块
|
||||
location /status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
# allow 10.0.0.0/24;
|
||||
# deny all;
|
||||
}
|
||||
}
|
||||
|
||||
server
|
||||
{
|
||||
listen 8088;
|
||||
server_name localhost;
|
||||
location / {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
|
||||
# another virtual host using mix of IP-, name-, and port-based configuration
|
||||
#
|
||||
#server {
|
||||
# listen 8000;
|
||||
# listen somename:8080;
|
||||
# server_name somename alias another.alias;
|
||||
|
||||
# location / {
|
||||
# root html;
|
||||
# index index.html index.htm;
|
||||
# }
|
||||
#}
|
||||
|
||||
|
||||
# HTTPS server
|
||||
#
|
||||
#server {
|
||||
# listen 443;
|
||||
# server_name localhost;
|
||||
|
||||
# ssl on;
|
||||
# ssl_certificate cert.pem;
|
||||
# ssl_certificate_key cert.key;
|
||||
|
||||
# ssl_session_timeout 5m;
|
||||
|
||||
# ssl_protocols SSLv2 SSLv3 TLSv1;
|
||||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
|
||||
# location / {
|
||||
# root html;
|
||||
# index index.html index.htm;
|
||||
# }
|
||||
#}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
###############################################################
|
||||
## NAME
|
||||
## install.sh install nginx in server
|
||||
##
|
||||
## USAGE
|
||||
## ./install.sh
|
||||
###############################################################
|
||||
|
||||
|
||||
## following is recommanded configure and modules.
|
||||
iUser="`whoami`"
|
||||
|
||||
make clean
|
||||
|
||||
./configure \
|
||||
--prefix=/home/${iUser}/nginx \
|
||||
--sbin-path=/home/${iUser}/nginx/sbin/nginx \
|
||||
--conf-path=/home/${iUser}/nginx/conf/nginx.conf \
|
||||
--pid-path=/home/${iUser}/nginx/pid/nginx.pid \
|
||||
--error-log-path=/home/${iUser}/nginx/log/error.log \
|
||||
--http-log-path=/home/${iUser}/nginx/log/access.log \
|
||||
--user=${iUser} --group=${iUser} \
|
||||
--with-http_ssl_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-pcre=/home/${iUser}/sw/pcre-8.34 \
|
||||
--with-zlib=/home/${iUser}/sw/zlib-1.2.8 \
|
||||
--with-openssl=/home/${iUser}/sw/openssl-1.0.1c
|
||||
|
||||
## compile nginx form source code
|
||||
make
|
||||
|
||||
## install nginx
|
||||
make install
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
#!/bin/bash
|
||||
################################################################
|
||||
# NAME
|
||||
# postinstall.sh post install some sw and configure after
|
||||
# vagrant virtual machine installed for ubuntu
|
||||
# postinstall.sh post install some sw in
|
||||
# vagrant virtual machine
|
||||
# NOTE
|
||||
# the base box is ubuntu 12.04 lts, which is download from
|
||||
# http://files.vagrantup.com/precise32.box
|
||||
################################################################
|
||||
echo
|
||||
echo "-----------------------------------"
|
||||
echo "postinstall start."
|
||||
|
||||
VAGRANTPATH="/vagrant_data"
|
||||
|
||||
# change source list
|
||||
|
@ -17,16 +18,11 @@ cp ${VAGRANTPATH}/sources.list /etc/apt/
|
|||
sudo apt-get update
|
||||
|
||||
echo
|
||||
echo "-----------------------------------"
|
||||
echo "install some necessary software."
|
||||
sudo apt-get install -y \
|
||||
emacs zsh vim g++ build-essential \
|
||||
make git ghostscript
|
||||
|
||||
iUser="`whoami`"
|
||||
echo "now user: ${iUser}"
|
||||
if [ ${iUser} = "root" ];then
|
||||
su vagrant
|
||||
echo "changed user, now: `whoami`"
|
||||
fi
|
||||
|
||||
echo "postinstall finished."
|
||||
echo "-----------------------------------"
|
||||
echo
|
Loading…
Reference in New Issue