命令流水帐之二:配置Server环境LAMP
生活随笔
收集整理的這篇文章主要介紹了
命令流水帐之二:配置Server环境LAMP
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為什么80%的碼農都做不了架構師?>>> ??
一、目標:Linux系統,MySQL,Wordpress,zentao,nginx轉發
二、環境:
桌面環境:Win10系統,Git bash,Chrome瀏覽器(插件:代理助手),ShadowSocks
服務器環境:CentOS6.4 32位操作系統,國外VPS
三、步驟:
1、安裝軟件,下載禪道,下載Wordpress:
cat /etc/*release* #查看系統版本 yum install httpd php php-devel pcre-devel php -v wget http://dl.cnezsoft.com/zentao/9.0.1/zentaopms-9.0.1-1.noarch.rpm rpm -iv --replacepkgs zentaopms-9.0.stable-1.noarch.rpm #安裝禪道 wget https://cn.wordpress.org/wordpress-4.7.2-zh_CN.tar.gz #安裝Wordpress tar xvf wordpress-4.7.2-zh_CN.tar.gz mv wordpress /opt/2、服務器配置域名規則:
vim /etc/httpd/conf/httpd.conf vim /usr/local/nginx/conf/nginx.conf httpd.conf增加虛擬主機設置:Listen 9090 NameVirtualHost *:9090AddType text/css .css AddType text/javascript .js<VirtualHost *:9090>DocumentRoot /var/www/html/ </VirtualHost><VirtualHost *:9090>ServerName pm.域名ServerAlias pm.域名DocumentRoot /opt/zentao/www/<Directory /opt/zentao/www/>Options FollowSymLinksAllowOverride All</Directory> </VirtualHost><VirtualHost *:9090>ServerName w.域名ServerAlias w.域名DocumentRoot /opt/wordpress/<Directory /opt/wordpress/>Options FollowSymLinksAllowOverride All</Directory> </VirtualHost>分別為: 從80端口修改為監聽9090端口;辨別css文件和js文件; 默認訪問/var/www/html/路徑; 子域名【pm.域名】訪問/opt/zentao/www/路徑; 子域名【w.域名】訪問/opt/wordpress/路徑nginx.conf增加轉發9090端口規則: server {listen 80;server_name w.域名 pm.域名;location / {proxy_pass http://127.0.0.1:9090;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}}3、配置.htaccess文件:
[root@MyServer wordpress]# cat /opt/wordpress/.htaccess Options +FollowSymLinks +SymLinksIfOwnerMatch AddType text/css .css AddType text/javascript .js[root@MyServer wordpress]# cat /opt/wordpress/.htaccess Options +FollowSymLinks +SymLinksIfOwnerMatch AddType text/css .css AddType text/javascript .js [root@MyServer wordpress]# cat /opt/zentao/www/.htaccess Options +FollowSymLinks +SymLinksIfOwnerMatch AddType text/css .css AddType text/javascript .js# framework router settings. 略...配置.htaccess文件使服務器能正確發送css文件與js文件,否則將導致禪道與wordpress樣式混亂,界面錯亂。
4、其它配置:
mysql 賬戶配置:mysql -uroot -h127.0.0.1 -p
show schemas; create schema wordpress; CREATE USER '用戶名'@'127.0.0.1' IDENTIFIED BY '密碼'; GRANT all privileges ON wordpress.* TO '用戶名'@'127.0.0.1' IDENTIFIED BY '密碼';vsftpd配置:
yum install vsftpd #安裝ftp服務器 vim /etc/vsftpd/vsftpd.conf #配置ftp服務器 useradd -d /opt/wordpress/ -s /sbin/nologin 用戶名 #設置ftp登陸用戶,主目錄位于/opt/wordpress/ passwd 用戶名 #設置用戶的密碼wordpress安裝插件iNove,下載地址:https://wordpress.org/themes/inove/
設置iptables,增加規則:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT5、重啟服務:
service httpd restart nginx -s restart service vsftpd restart service iptables restart6、訪問域名一步步配置。
轉載于:https://my.oschina.net/d63hbz/blog/844013
總結
以上是生活随笔為你收集整理的命令流水帐之二:配置Server环境LAMP的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Eclipse与MyEclipse增强代
- 下一篇: 华为离职副总裁徐家骏:透露年薪千万的工作