1.nginx javascript
命令: 啓動 start nginxcss
中止 nginx -s stopjava
重啓 nginx -s reloadnode
配置參數nginx
http:{web
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
access_log off;
keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
reset_timedout_connection on;
send_timeout 10;
gzip on;
gzip_disable "msie6";
gzip_proxied any;
gzip_min_length 1000;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/x-javascript application/xml text/xml application/xml+rss text/javascript;數據庫
} apache
2. apache json
2.1主要講講配置二級域名,查閱了一些資料,剛開始弄了很久沒弄明白,原來能夠經過一種簡單的方式來解決 windows
好比有網站域名 yeegee.com 想在服務器上,經過二級域名來控制訪問不一樣目錄
假設有兩個web項目 bbsproj 項目 , videoproj 項目 , 想達到的效果,是經過設置二級域名
bbs.yeegee.com來訪問bbsproj 項目主頁 ,video.yeegee.com來訪問videoproj項目主頁,那麼就要進行以下設置:
1.打開conf/httpd.conf,啓用http代理
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
注意,同時也要配置下面這句(支持多站點)
LoadModule vhost_alias_module modules/mod_vhost_alias.so
2.2引用外部配置文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
若是前面有#號,請去掉。
2.3.配置httpd-vhosts.conf, 如下是實際項目中用到的配置文件,請君品鑑:
<VirtualHost *:80>
ServerAdmin chenyb12345@163.com
ServerName www.yeegee.com
ServerAlias www.yeegee.com
ProxyPass / http://www.yeegee.com:801
ProxyPassReverse / http://www.yeegee.com:801
ErrorLog "logs/www.yeegee.com-error.log"
CustomLog "logs/www.yeegee.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin chenyb12345@163.com
ServerName download.yeegee.com
ServerAlias download.yeegee.com
ProxyPass / http://download.yeegee.com:802
ProxyPassReverse / http://download.yeegee.com:802
ErrorLog "logs/download.yeegee.com-error.log"
CustomLog "logs/download.yeegee.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin chenyb12345@163.com
ServerName taxi.yeegee.com
ServerAlias taxi.yeegee.com
ProxyPass / http://taxi.yeegee.com:803
ProxyPassReverse / http://taxi.yeegee.com:803
ErrorLog "logs/taxi.yeegee.com-error.log"
CustomLog "logs/taxi.yeegee.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin chenyb12345@163.com
ServerName wx.yeegee.com
ServerAlias wx.yeegee.com
ProxyPass / http://wx.yeegee.com:8710/
ProxyPassReverse / http://wx.yeegee.com:8710/
ErrorLog "logs/wx.yeegee.com-error.log"
CustomLog "logs/wx.yeegee.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin chenyb12345@163.com
ServerName trace.chengchengda.com
ServerAlias trace.chengchengda.com
ProxyPass / http://121.196.236.198:8000/gtopTracker/
ProxyPassReverse / http://121.196.236.198:8000/gtopTracker/
ProxyPassReverseCookiePath /gtopTracker /
ErrorLog "logs/wx.chengchengda.com-error.log"
CustomLog "logs/wx.chengchengda.com-access.log" common
</VirtualHost>
** ProxyPassReverseCookiePath 是爲了在轉發時,cookie的級別從 /gtopTracker 提高到 / ,這樣,就不會出現session失效的問題了。
配好以後,重啓服務器,就能夠經過 wx.yeegee.com訪問8710端口所在服務器的項目了,若是是須要指定到myapp項目怎麼辦呢? 很簡單,把上面的 http://wx.yeegee.com:8710/ 改爲 http://wx.yeegee.com:8710/myapp/ 就ok了。 記住,不能少反斜槓哦。
關於windows 服務器上,若是訪問量很大,須要配置的是conf/extra/httpd-mpm.conf
<IfModule mpm_winnt_module>
ThreadsPerChild 450
MaxConnectionsPerChild 10000
</IfModule>
根據實際須要作好相應配置便可。
3.tomcat 主要記錄一下啓動配置參數
修改bin/catalina.bat 在首行寫入這句
set JAVA_OPTS=-server -Xms128m -Xmx256m -Xss512k -XX:+AggressiveOpts -XX:+UseBiaseLocking -XX:PermSize=256M -XX:MaxNewSize=256M -XX:+DisableExplicitGC -XX:MaxTenuringThreshold=31 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -XX:MaxPermSize=256m
具體什麼意思,百度查下吧,我就偷個懶。。。
下次抽個時間整理一下oracle數據庫的優化,oracle的內容比這要多不少。。
但願此次的內容可以對你有所幫助,若有錯誤歡迎批評指正,若是有興趣,能夠發郵件到個人Email: chenyb12345@163.com。但願和各位成爲好朋友,歡迎你們一塊兒討論,一塊兒進步。
4.nginx二級域名轉發配置
http { include mime.types; default_type application/octet-stream; charset utf-8; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; access_log off; client_max_body_size 50m; keepalive_timeout 10; client_header_timeout 10; client_body_timeout 10; reset_timedout_connection on; send_timeout 10; gzip on; gzip_disable "msie6"; gzip_proxied any; gzip_min_length 1000; gzip_comp_level 4; gzip_types text/plain text/css application/json application/x-javascript application/xml text/xml application/vnd.apple.mpegurl video/mp2t application/xml+rss text/javascript; server { listen 80; server_name a.domain.com; location / { root www; } } server{ listen 80; server_name b.domain.com; location / { proxy_pass http://127.0.0.1:8080/demo1/; proxy_redirect default; 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_set_header Cookie $http_cookie; proxy_connect_timeout 30; } } server{ listen 80; server_name wx.domain.com; location / { proxy_pass http://127.0.0.1:8081/demo2/; proxy_redirect default; 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_set_header Cookie $http_cookie; proxy_connect_timeout 30; } } }