yum install java-1.7.0-openjdk* -y
因爲CentOS 7 版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替,因此安裝mariabdjavascript
yum install mariadb-server mariadb
操做mariadb的命令是:css
systemctl start mariadb #啓動MariaDB systemctl stop mariadb #中止MariaDB systemctl restart mariadb #重啓MariaDB systemctl enable mariadb #設置開機啓動
systemctl start mariadb
默認帳號是root,沒有密碼,因此直接登錄html
mysql -u root
[mysql] default-character-set =utf8
grant usage on *.* to 'fred'@'localhost' identified by 'fred';//建立用戶fred密碼ferd select host,user,password from mysql.user where user='fred';//查看記錄 grant all privileges on *.* to fred@'%'identified by 'fred';//設置能夠遠程訪問
sudo yum install vsftpd
adduser userftp //添加用戶
passwd userftp
usermod -s /sbin/nologin userftp
sudo vi /etc/vsftpd/vstfpd.conf anonymous_enable=NO //關閉匿名訪問 local_enable=YES //只能訪問本身的主目錄 local_root=/data/doc //設置主目錄 sudo service vsftpd restart //重啓 ckconfig vsftpd on //設置開機自啓動
wget http://mirrors.noc.im/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.zip unzip apache-tomcat-7.0.69.zip
yum -y install nginx
gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 6; gzip_types text/html text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml; gzip_vary on; proxy_cache_path /nginx/cache levels=1:2 keys_zone=first:10m inactive=24h max_size=1G; #新建緩存路徑與相關屬性 upstream backend { #創建後端tomcat服務器 server 127.0.0.1:8080 weight=1; }
listen 80; #return 500; server_name blog.yoqu.org ; index index.html index.htm index.jsp;#設定訪問的默認首頁地址 root /web/webapp;#設定網站的資源存放路徑 #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { #root /usr/software/tomcat/webapps/finalcms; #index index.html index.htm; proxy_pass http://127.0.0.1:8080; proxy_redirect off; # 後端的Web服務器能夠經過X-Forwarded-For獲取用戶真實IP proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root /web/webapp; #expires 12d; proxy_cache first; proxy_cache_valid 200 24h; proxy_cache_valid 302 10m; } location ~ ^/(WEB-INF)/ { deny all; }
<Engine name="Catalina"defaultHost="blog.yoqu.org""> <Host name="blog.yoqu.org" appBase="/web" unpackWARs="true" autoDeploy="true"> <Context path="/" docBase="webapp" reloadable="true"/> </Host>