LNMP鎼缓
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LNMP鎼缓相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%9b%bf%e6%8d%a2' title='鏇挎崲'>鏇挎崲 闃诲 oca ash 鐜 澶у皬 澶氳矾澶嶇敤 multiple
LNMP鎼缓
1銆佷笅杞藉苟瀹夎LNMP涓€閿畨瑁呭寘(瀹樼綉lnmp.org)锛?/p>
tar -zxvf lnmp1.2-full.tar.gz
cd lnmp1.2-full
./install.sh lnmp
瀹夎LNMP鎵ц锛歸get -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz && tar zxf lnmp1.2-full.tar.gz && cd lnmp1.2-full && ./install.sh lnmp
濡傞渶瑕佸畨瑁匧NMPA鎴朙AMP锛屽皢./install.sh 鍚庨潰鐨勫弬鏁版浛鎹负lnmpa鎴杔amp鍗冲彲銆?br />
鎸変笂杩板懡浠ゆ墽琛屽悗锛屼細鍑虹幇濡備笅鎻愮ず锛?/p>
闇€瑕佽缃甅ySQL鐨剅oot瀵嗙爜锛堜笉杈撳叆鐩存帴鍥炶溅灏嗕細璁剧疆涓簉oot锛夛紝杈撳叆鍚庡洖杞﹁繘鍏ヤ笅涓€姝ワ紝濡備笅鍥炬墍绀猴細
杩欓噷闇€瑕佺‘璁ゆ槸鍚﹀惎鐢∕ySQL InnoDB锛屽鏋滀笉纭畾鏄惁鍚敤鍙互杈撳叆 y 锛岃緭鍏?y 琛ㄧず鍚敤锛岃緭鍏?n 琛ㄧず涓嶅惎鐢ㄣ€傞粯璁や负y 鍚敤锛岃緭鍏ュ悗鍥炶溅杩涘叆涓嬩竴姝ワ紝閫夋嫨MySQL鐗堟湰锛?/p>
杈撳叆MySQL鎴朚ariaDB鐗堟湰鐨勫簭鍙凤紝鍥炶溅杩涘叆涓嬩竴姝ワ紝閫夋嫨PHP鐗堟湰锛?/p>
杈撳叆PHP鐗堟湰鐨勫簭鍙凤紝鍥炶溅杩涘叆涓嬩竴姝ワ紝閫夋嫨鏄惁瀹夎鍐呭瓨浼樺寲锛?/p>
鍙互閫夋嫨涓嶅畨瑁呫€丣emalloc鎴朤Cmalloc锛岃緭鍏ュ搴斿簭鍙峰洖杞︺€?br /> 濡傛灉鏄疞NMPA鎴朙AMP鐨勮瘽杩橀渶瑕佽缃鐞嗗憳閭
鍐嶉€夋嫨Apache/nginx鐗堟湰
鎻愮ず"Press any key to install...or Press Ctrl+c to cancel"鍚庯紝鎸夊洖杞﹂敭纭寮€濮嬪畨瑁呫€?br /> LNMP鑴氭湰灏变細鑷姩瀹夎缂栬瘧Nginx銆丮ySQL銆丳HP銆乸hpMyAdmin銆乑end Optimizer杩欏嚑涓蒋浠躲€?br /> 鎴愬姛鎻愮ず Nginx: OK锛孧ySQL: OK锛孭HP: OK
浜?LNMP鐩稿叧杞欢瀹夎鐩綍
Nginx 鐩綍: /usr/local/nginx/
mysql 鐩綍 : /usr/local/mysql/
MySQL鏁版嵁搴撴墍鍦ㄧ洰褰曪細/usr/local/mysql/var/
php鐩綍 : /usr/local/php/
PHPMyAdmin鐩綍 : /home/wwwroot/default/phpmyadmin/
榛樿缃戠珯鐩綍 : /home/wwwroot/default/
Nginx鏃ュ織鐩綍锛?home/wwwlogs/
涓?LNMP鐩稿叧閰嶇疆鏂囦欢浣嶇疆
Nginx涓婚厤缃枃浠讹細/usr/local/nginx/conf/nginx.conf
MySQL閰嶇疆鏂囦欢锛?etc/my.cnf
PHP閰嶇疆鏂囦欢锛?usr/local/php/etc/php.ini
php-fpm閰嶇疆鏂囦欢锛?usr/local/php/etc/php-fpm.conf
鍥?LNMP鐘舵€佺鐞嗗懡浠?br />
LNMP 鐘舵€佺鐞? lnmp start|stop|reload|restart|kill|status
LNMP 鍚勪釜绋嬪簭鐘舵€佺鐞? lnmp nginx|mysql|mariadb|php-fpm|pureftpd start|stop|reload|restart|kill|status
浜?閰嶇疆鏂囦欢
vi /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes auto;
鍚姩杩涚▼
error_log /home/wwwlogs/nginx_error.log crit;
閿欒鏃ュ織
pid /usr/local/nginx/logs/nginx.pid;
涓昏繘绋婸ID淇濆瓨鏂囦欢
Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
缃戠粶I/O妯″瀷锛屽缓璁甽inux浣跨敤epoll锛孎reeBSD浣跨敤kqueue
epoll鏄璺鐢↖O(I/O Multiplexing)涓殑涓€绉嶆柟寮?浣嗘槸浠呯敤浜巐inux2.6浠ヤ笂鍐呮牳,鍙互澶уぇ鎻愰珮nginx鐨勬€ц兘
worker_connections 51200;
鍗曚釜宸ヤ綔杩涚▼鏈€澶у厑璁歌繛鎺ユ暟
multi_accept on;
http
鏁翠綋鐜閰嶇疆
include mime.types;
default_type application/octet-stream;
璁惧畾mime绫诲瀷,鏂囦欢浼犻€佺被鍨嬬敱mime.type鏂囦欢瀹氫箟
server_names_hash_bucket_size 128; #淇濆瓨鏈嶅姟鍣ㄥ悕瀛楃殑hash琛ㄥぇ灏? client_header_buffer_size 32k; #瀹㈡埛绔姹傚ご閮ㄧ紦鍐插尯澶у皬
large_client_header_buffers 4 32k; #鏈€澶у鎴风澶寸紦鍐插ぇ灏? client_max_body_size 50m; #瀹㈡埛绔渶澶т笂浼犳枃浠跺ぇ灏忥紙M锛?
sendfile on;
sendfile 鎸囦护鎸囧畾 nginx 鏄惁璋冪敤 sendfile 鍑芥暟锛坺ero copy 鏂瑰紡锛夋潵杈撳嚭鏂囦欢锛屽浜庢櫘閫氬簲鐢紝蹇呴』璁句负 on銆傚鏋滅敤鏉ヨ繘琛屼笅杞界瓑搴旂敤纾佺洏IO閲嶈礋杞藉簲鐢紝鍙缃负off锛屼互骞宠 纾佺洏涓庣綉缁淚/O澶勭悊閫熷害锛岄檷浣庣郴缁熺殑uptime.
楂樻晥鏂囦欢浼犺緭
tcp_nopush on;
杩炴帴瓒呮椂鏃堕棿
tcp_nodelay on;
fastcgi璁剧疆
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
server_tokens off;
闅愯棌nginx鐗堟湰鍙凤紙curl -I 192.168.4.154鍙互鏌ョ湅锛屾洿鍔犲畨鍏級
#log format
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
瀹氫箟鏃ュ織鏍煎紡
server
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
鐩戝惉80绔彛
server_name www.lnmp.org;
鏈嶅姟鍣ㄥ悕
index index.html index.htm index.php;
榛樿缃戦〉鏂囦欢
root /home/wwwroot/default;
error_page 404 /404.html;
include enable-php.conf;
location /nginx_status
stub_status on;
access_log off;
闈欐€佹枃浠跺鐞嗭紝淇濆瓨鏈?0澶?/h1>
location ~ .*.(js|css)?$
expires 12h;
js鍜宑ss鏂囦欢澶勭悊锛屼繚瀛樻湡12灏忔椂
location ~ /.
deny all;
access_log /home/wwwlogs/access.log access;
姝g‘璁块棶鏃ュ織
include vhost/*.conf;
vhost/涓嬪瓙閰嶇疆鏂囦欢鐢熸晥
以上是关于LNMP鎼缓的主要内容,如果未能解决你的问题,请参考以下文章