Linux伺服器軟體安裝備忘

來源:互聯網
上載者:User

標籤:des   style   blog   http   io   color   ar   os   使用   

1.Centos安裝Mysql
 1 --安裝 2 yum install mysql-server   卸載 yum -e mysql-server 3 --設定為開機啟動 4 chkconfig mysqld on 5 --啟動mysql 6 service mysqld start 7 --設定root密碼 8 mysqladmin -u root password ‘xxx‘ 9 #雙機熱備10 GRANT REPLICATION SLAVE ON *.* TO ‘backup‘@‘192.168.1.33‘ IDENTIFIED BY ‘backup_xxx‘;11 #一般帳號12 --GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘localhost‘ IDENTIFIED BY ‘password‘;13 flush privileges;14 亂碼:15 [mysqld]16 #add17 default-character-set = utf818 character-set-server = utf819 collation-server = utf8_general_ci20 init_connect = ‘SET collation_connection = utf_general_ci‘21 init_connect = ‘SET NAMES utf8‘22 [mysqld_safe]
2.安裝Redis
wget http://download.redis.io/releases/redis-2.8.7.tar.gz  or  http://download.redis.io/releases/redis-2.6.17.tar.gztar -zvxf xxxconfiguremake && make install  
3.啟動memcached
memcached -d -m 100 -u root -p 11211 -P /tmp/memcached.pid
4.防火牆:
 1 Iptables: 2 啟動iptables 3 service iptables start 4 iptables --list //*查看iptables規則集*// 5 下面是沒有定義規劃時iptables的樣子: 6 Chain INPUT (policy ACCEPT) 7 target     prot opt source               destination 8 Chain FORWARD (policy ACCEPT) 9 target     prot opt source               destination10 Chain OUTPUT (policy ACCEPT)11 target     prot opt source               destination12 如何開啟/關閉指定連接埠13 例如:14 開啟81連接埠:15 iptables -I INPUT -i eth0 -p tcp --dport 81 -j ACCEPT16 iptables  -I OUTPUT -o eth0 -p tcp --sport 81 -j ACCEPT17 關閉81連接埠:18 iptables -I INPUT -i eth0 -p tcp --dport 81 -j DROP19 iptables -I OUTPUT -o eth0 -p tcp --sport 81 -j DROP20 然後儲存21 /etc/rc.d/init.d/iptables save22 你可以使用lsof命令來查看某一連接埠是否開放.查看連接埠可以這樣來使用.23 我就以81連接埠為例:24 lsof -i:8125 如果有顯示說明已經開放了.如果沒有顯示說明沒有開放
5.環境變數
1 Tomcat JVM配置--catalina.bat/catalina.sh2 windows3 set JAVA_OPTS = -Xmx512m -Xms512m -XX:MaxPermSize=256m4 linux5 JAVA_OPTS ="-server -Xmx400m -Xms400m -Xmn128m -XX:MaxPermSize=128m -XX:PermSize=128m"
6.項目直接存取
1 【Tomcat直接存取項目--去掉訪問路徑上的項目名稱】2 修改Tomcat_Home/conf/server.xml3 <Host> 下添加  <Context path="" docBase="項目路徑" reloadable="true" />4 path為訪問路徑,與request.getContextPath()傳回值一樣。
7.Nginx配置:

安裝 pcre-devel openssl-devel

 1 http{ 2  #... 3  gzip on; 4  gzip_min_length 1k; 5  gzip_buffers 16 64k; 6  gzip_http_version 1.1; 7  gzip_comp_level 4; 8  gzip_types text/plain text/css application/xml image/png; #... 9  gzip_vary on;10  sendfile   on;11  client_max_body_size 1024m;#附件上傳 12     upstream e_learning{13         server 192.168.1.30:8080;14         server 192.168.1.31:8080;15         ip_hash;16     }17     server{18         listen      80;19         server_name 192.168.1.34;20         index       index.jsp;21         location / {22             index   index.jsp;23             proxy_pass  http://e_learning;24             proxy_set_header    Host    $host;25             proxy_set_header    X-Real_IP   $remote_addr;26             proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;27         }28         location ^~ /upload/ {29             expires 10d;30             root    /var/e_learning;31         }32         location ^~ /vod {33             proxy_pass http://192.168.1.36:1935/vod/;34             proxy_set_header    Host    $host;35             proxy_set_header    X-Real_IP   $remote_addr;36             proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;37         }38         location ~*\.(gif|jpg|png|js|css)$ {39             expires 10d;40             proxy_pass  http://e_learning;41             proxy_set_header    Host    $host;42             proxy_set_header    X-Real_IP   $remote_addr;43             proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;44         }45     }46 }

 

Linux伺服器軟體安裝備忘

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.