91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

lamp discuz+wordpress+phpmyadmin

發布時間:2020-07-01 23:04:11 來源:網絡 閱讀:1563 作者:365940075 欄目:數據庫

實驗課題:搭建LAMP,安裝Nginx,作為代理,將MySQL安裝在單獨的機器,apache負責動態,nginx負責靜態

需求如下:
1. 準備兩臺centos 6,其中一臺機器跑mysql,另外一臺機器跑apache和nginx + php 
2. 同時安裝apache和nginx,其中nginx啟動80端口,用來跑靜態對象(圖片、js、css),apache監聽88端口,負責跑動態頁(php相關的),并且需要由nginx代理對外訪問
3. mysql服務器需要開啟慢查詢日志
4. 搭建discuz、wordpress以及phpmyadmin,域名分別為bbs.xin.com, blog.xin.com, pma.xin.com
5. 配置discuz的偽靜態(nginx)
6. apache不需要記錄日志,nginx記錄日志,但不記錄圖片等靜態頁的日志,并且配置日志切割
7. 配置圖片防盜鏈(nginx)
8. 配置圖片緩存7天,js,css緩存1天(nginx)
9. discuz和wordpress訪問后臺限制一下ip白名單,比如只允許192.168.244.1訪問(nginx)
10. phpmyadmin整個站點需要配置用戶認證(nginx)
11. 寫一個mysql備份的腳本,每天5點執行,需要遠程拷貝到web機器上
12. 把除了百度、google外的其他常見搜索引擎蜘蛛封掉,比如(bingbot/2.0、Sogou web spider/4.0、360Spider、YisouSpider、YandexBot/3.0)(nginx)

大家好,里面的圖片僅供參考,只是一種思路,不要照搬!!


實驗環境:

1、VMware Workstation 12

2、設備A:MySQL,IP地址:192.168.244.146,Host:mysql-m

3、設備B:Nginx+Apache+PHP,IP地址:192.168.244.139,Host:lanmp 真機:192.168.244.1

4、Linux發行版:Centos 6.7 x86-64;

5、Nginx:http://nginx.org/download/nginx-1.10.0.tar.gz

6、Apache:http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.18.tar.gz

7、PHP:http://cn2.php.net/get/php-5.6.21.tar.gz

8、MySQL:http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.49.tar.gz

9、discuz:http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

10、wordpress:https://cn.wordpress.org/wordpress-4.2.2-zh_CN.tar.gz

11、phpmyadmin:https://files.phpmyadmin.net/phpMyAdmin/4.6.2/phpMyAdmin-4.6.2-all-languages.zip

12、pcre: http://sourceforge.net/projects/pcre/files/pcre2/10.20/pcre2-10.20.tar.gz 

13、apr:  http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz 

14、apr-util :  http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz 



實驗準備:

1 ,安裝依賴包

 yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ flex bison bzip2 bzip2-devel libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

2、分別在設備A和B中下載各個軟件;

A,下載mysql

#wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.49.tar.gz

B,下載

# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.18.tar.gz

# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz 

# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz 

# wget http://cn2.php.net/get/php-5.6.21.tar.gz

# wget http://nginx.org/download/nginx-1.10.0.tar.gz

# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_TC_UTF8.zip

# wget https://cn.wordpress.org/wordpress-4.2.2-zh_CN.tar.gz

# wget https://files.phpmyadmin.net/phpMyAdmin/4.6.2/phpMyAdmin-4.6.2-all-languages.zip

3、更新系統時間;

# crontab -e

*/30  * * * *   /usr/sbin/ntpdate tiger.sina.com.cn > /dev/dull 2>1&

4、清空Iptables,關閉Selinux,或者添加數據庫和網站的訪問權限。

chkconfig iptables off

chkconfig ip6tables off

/etc/init.d/iptables stop

# /etc/init.d/ip6tables stop

sed -i "s/LINUX=.*/LINUX=disabled/g" /etc/selinux/config 

# reboot (shutdown -h now)


實驗步驟:

設備A:mysql

參考文檔(mysql 5-5

# yum install  -y gcc gcc-c++ cmake ncurses-devel wget

# cd /usr/local/src/

# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.49.tar.gz

# useradd -s /sbin/nologin -M mysql

# mkdir -p /data/mysql

# chown -R mysql:mysql /data/mysql

# tar -zxvf mysql-5.5.49.tar.gz

# cd /usr/local/src/mysql-5.5.49

#cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/data/mysql  -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql  -DMYSQL_TCP_PORT=3306

# make && make install
# cd /usr/local/mysql/

# chown -R mysql:mysql /usr/local/mysql/

# /usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql/

# cd /usr/local/mysql/support-files/

# cp my-small.cnf /etc/my.cnf

# cp mysql.server /etc/init.d/mysqld

# vim /etc/init.d/mysqld

找到basedir,datadir將相對應的安裝目錄和數據目錄添加

basedir=/usr/local/mysql

datadir=/data/mysql

# /etc/init.d/mysqld stop

# ps aux |grep mysql

# netstat -lnp |grep 3306

# mysql -uroot -p <輸入你的mysql登錄密碼,默認為空>

# create database discuz;

# create database wordpress;

# grant all on *.* to 'discuz'@'192.168.244.139' identified by 'discuz';

# quit

參考:

### grant all on *.* to '用戶名字'@'web服務器ip地址' identified by '用戶密碼';




設備B:lanmp

一、安裝Apache

參考文檔 ( KVM )

# cd /usr/local/src/

#wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.18.tar.gz

#wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz 

#wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz 

# tar zxvf apr-util-1.5.4.tar.gz

# tar zxvf apr-1.5.2.tar.gz

# tar zxvf httpd-2.4.18

# cp -r apr-1.5.2 httpd-2.4.18/srclib/apr

# cp -r apr-util-1.5.4 httpd-2.4.18/srclib/apr-util

# cd httpd-2.4.18

# ./configure --prefix=/usr/local/apache2/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared

# make && make install && echo $?

# /usr/local/apache2/bin/apachectl start

#echo "/usr/local/apache2/bin/apachectl  start"  >> /etc/rc.local

#vim /etc/profile.d/path.sh

#!/bin/bash

export PATH=$PATH:/usr/local/apache2/bin

#source  /etc/profile.d/path.sh

#apachectl -t (檢查語法)

#apachectl restart 


二、安裝PHP

#wget http://cn2.php.net/get/php-5.6.21.tar.gz

#tar zxvf php-5.6.21.tar.gz

#cd php-5.6.21

# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir  --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrpt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6

###    傳統的安裝php的方式中,我們在編譯PHP時,一般需要指定以下幾項:
###       --with-mysql=/usr/local/mysql 

###       --with-pdo-mysql=/usr/local/mysql

###    這實際上使用了mysql官方自帶的libmysql驅動這是比較老的驅動, PHP 5.3開始已經

###    不建 議使用它了而建議使用mysqlnd. 

###      mysqlnd內置于PHP源代碼,故你在編譯安裝php時就不需要預先安裝mysql server

###  可以提供mysql client API (mysql_connect, pdo , mysqli), 這將減化一些工作量.

# make && make install && echo $?

# cp /usr/local/src/php-5.6.21/php.ini-production /usr/local/php/etc/php.ini


三、配置PHP和Apache結合

#vim /usr/local/apache2/conf/httpd.conf

修改內容如下圖:

修改前:

lamp  discuz+wordpress+phpmyadmin

修改后:

lamp  discuz+wordpress+phpmyadmin

修改前:

lamp  discuz+wordpress+phpmyadmin

修改后:

lamp  discuz+wordpress+phpmyadmin

修改前:


lamp  discuz+wordpress+phpmyadmin

修改后:

lamp  discuz+wordpress+phpmyadmin


查看是否存在modules/libphp5.so


lamp  discuz+wordpress+phpmyadmin

lamp  discuz+wordpress+phpmyadmin


測試LAMP環境:在瀏覽器訪問192.168.244.139,如果顯示IT Works!表示LAMP環境搭建成功



四、discuz、wordpress、phpmyadmin配置


# mkdir -p /date/{discuz,blog,pma}


lamp  discuz+wordpress+phpmyadmin


1 配置discuz

# unzip Discuz_X3.2_SC_UTF8.zip

mv upload/*  /date/discuz



2 配置wordpress


# tar zxvf wordpress-4.2.2-zh_CN.tar.gz

# mv wordpress/* /date/blog/



3 配置phpmyadmin


# unzip phpMyAdmin-4.4.13.1-all-languages.zip

# mv phpMyAdmin-4.4.13.1-all-languages/* /date/pma/



打開虛擬主機配置文件

修改前:

lamp  discuz+wordpress+phpmyadmin

修改后:

lamp  discuz+wordpress+phpmyadmin


# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf 


<VirtualHost *:88>

    DocumentRoot "/date/discuz/"

    ServerName bbs.xin.com

    ErrorLog "logs/bbs.xin.com-error_log"

    CustomLog "logs/bbs.xin.com-access_log" common

</VirtualHost>


<VirtualHost *:88>

    DocumentRoot "/date/blog/"

    ServerName blog.xin.com

    ErrorLog "logs/blog.xin.com-error_log"

    CustomLog "logs/blog.xin.com-access_log" common

</VirtualHost>


lHost *:88>

    DocumentRoot "/date/pma/"

    ServerName pma.xin.com

    ErrorLog "logs/pma.xin.com-error_log"

    CustomLog "logs/pma.xin.com-access_log" common

</VirtualHost>

如下圖:

lamp  discuz+wordpress+phpmyadmin

#/usr/local/apache2/bin/apachectl -t   (apachectl -t)

檢測語法

#/usr/local/apache2/bin/apachectl graceful   (apachectl graceful)

加載配置文件

# netstat -lnp |grep 88

檢查88端口是否監聽

lamp  discuz+wordpress+phpmyadmin


在真機win上的host文件里綁定ip和虛擬主機域名(host文件路徑:C/windows/System32/drivers/etc/hosts
192.168.244.4  bbs.xin.com blog.xin.com pma.xin.com


安裝discuz
在瀏覽器訪問bbs.abc.com:88/install/,會出現discuz圖形安裝界面,點我同意,出現很多目錄不可寫,為啥不可寫呢?因為ps aux |grep httpd,httpd是以daemon用戶運行。所以需要把discuz中不可寫的目錄的屬主和屬組改成daemon,chown -R daemon:daemon /date/discuz
回到瀏覽器刷新,下一步,再全新安裝discuz
在mysql中創建discuz庫并授權一個用戶
mysql> create database discuz;
mysql> grant all on *.* to 'discuz'@'192.168.244.139' identified by 'discuz';
mysql> flush privileges;

mysql> quit

回到discuz瀏覽器,數據庫名為discuz,數據庫用戶名為discuz,數據庫密碼discuz,
到此discuz論壇安裝完畢


安裝wordpress
在瀏覽器中訪問blog.xin.com:88進行安裝

lamp  discuz+wordpress+phpmyadmin

lamp  discuz+wordpress+phpmyadmin


點提交:

lamp  discuz+wordpress+phpmyadmin

根據錯誤提示,在blog目錄下創建wp-config.php然后把瀏覽器中方框內信息拷貝至wp-config.php文件

lamp  discuz+wordpress+phpmyadmin

然后點擊進行安裝

lamp  discuz+wordpress+phpmyadmin

lamp  discuz+wordpress+phpmyadmin

點擊登陸,后面輸入剛才設置的用戶名和密碼 登陸就可以了 

lamp  discuz+wordpress+phpmyadmin


安裝phpmyadmin

#cd /date/pma

#cp libraries/config.default.php config.inc.php  

#vim config.inc.php 

更改內容如下:

$cfg['Servers'][$i]['user'] = 'root';   ###數據庫的用戶名root
$cfg['Servers'][$i]['password'] = 'yourrootpassword'; ###數據庫的root密碼
$cfg['Servers'][$i]['host'] = 'yourdbip';  ###數據庫的ip地址
$cfg['Servers'][$i]['auth_type'] = 'config';###認證模式把cookie改成config


數據庫服務器執行下面命令

#mysql -uroot password 'phpadmin'

#mysql -uroot -pphpadmin

>grant all on *.* to 'root'@'192.168.244.139' identified by 'phpadmin';


lamp  discuz+wordpress+phpmyadmin

lamp  discuz+wordpress+phpmyadmin

lamp  discuz+wordpress+phpmyadmin


lamp  discuz+wordpress+phpmyadmin



四、安裝nginx

參考文檔(nginx

配置nginx

# vim /usr/local/nginx/conf/nginx.conf

user nobody nobody;

worker_processes 2;

error_log /usr/local/nginx/logs/nginx_error.log crit;

pid /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 51200;


events

{

    use epoll;

    worker_connections 6000;

}


http

{

    include mime.types;

    default_type application/octet-stream;

    server_names_hash_bucket_size 3526;

    server_names_hash_max_size 4096;

    log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'

    '$host "$request_uri" $status'

    '"$http_referer" "$http_user_agent"';

    sendfile on;

    tcp_nopush on;

    keepalive_timeout 30;

    client_header_timeout 3m;

    client_body_timeout 3m;

    send_timeout 3m;

    connection_pool_size 256;

    client_header_buffer_size 1k;

    large_client_header_buffers 8 4k;

    request_pool_size 4k;

    output_buffers 4 32k;

    postpone_output 1460;

    client_max_body_size 10m;

    client_body_buffer_size 256k;

    client_body_temp_path /usr/local/nginx/client_body_temp;

    proxy_temp_path /usr/local/nginx/proxy_temp;

    fastcgi_temp_path /usr/local/nginx/fastcgi_temp;

    fastcgi_intercept_errors on;

    tcp_nodelay on;

    gzip on;

    gzip_min_length 1k;

    gzip_buffers 4 8k;

    gzip_comp_level 5;

    gzip_http_version 1.1;

    gzip_types text/plain application/x-javascript text/css text/htm application/xml;

    include vhosts/*.conf;

}

lamp  discuz+wordpress+phpmyadmin

通過上圖可以得到,nginx也支持虛擬主機,下面我們創建虛擬主機


# mkdir /usr/local/nginx/conf/vhosts

# cd /usr/local/nginx/conf/vhosts

# touch bbs.conf blog.conf pma.conf


lamp  discuz+wordpress+phpmyadmin

配置bbs.conf

#vim /usr/local/nginx/conf/vhosts/bbs.conf

server

{

    listen 80;

    server_name bbs.xin.com;

    index index.html  index.php;

    root /date/discuz;


    if ($http_user_agent ~'bingbot/2.0|MJ12bot/v1.4.2|Spider/3.0|YoudaoBot|Tomato|Gecko/20100315')

          {

            return 403;

          }

    location ~ admin.php {

        allow 192.168.244.1;

        deny all;

        proxy_pass   http://127.0.0.1:88;

        proxy_set_header Host   $host;

    }


    location ~ \.php$ {

         proxy_pass   http://127.0.0.1:88;

         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 ~ .*\.(js|css)?$

    {

          expires      24h;

          access_log off;

    }


    location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ {

         expires 7d;

         valid_referers none blocked server_names  *.baidu.com *.google.com *.google.cn *.soso.com ;

         if ($invalid_referer)

               {

              return 403;

              #rewrite ^/ http://www.xin.com/nophoto.gif;

               }

         access_log off;

    }


    rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;

    rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;

    rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;

    rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;

    rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;

    rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;

    access_log /home/logs/discuz.log combined_realip;

}



圖片錯誤提示:root /date/bbs  改成 /date/discuz


lamp  discuz+wordpress+phpmyadmin

# /usr/local/nginx/sbin/nginx -t

# service nginx configtest     

檢查語法

在瀏覽器訪問:bbs.xin.com,是可以訪問的


配置blog.conf

# vim /usr/local/nginx/conf/vhosts/blog.conf

server

{

    listen 80;

    server_name blog.xin.com;

    index index.html index.htm index.php;

    root /date/blog;


    location /wp-admin/ {

        allow 192.168.244.1;

        deny all;

        location ~ \.php$ {

        proxy_pass   http://127.0.0.1:88;

        proxy_set_header Host   $host;

        }

    }


    location  / {

         proxy_pass   http://127.0.0.1:88/;

         proxy_set_header Host   $host;

         proxy_set_header X-Real-IP      $remote_addr;

         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }


}

lamp  discuz+wordpress+phpmyadmin

# /usr/local/nginx/sbin/nginx -t

# service nginx configtest     

檢查語法

在瀏覽器訪問:blog.xin.com,是可以訪問的,自動跳轉到blog.xin.com:88


配置pma.conf

# vim /usr/local/nginx/conf/vhosts/pma.conf


server

{

    listen 80;

    server_name pma.xin.com;

    index index.html  index.php;

    root /date/pma;


    location / {

         auth_basic              "Auth";

         auth_basic_user_file   /usr/local/nginx/conf/htpasswd;


    location ~ \.php$ {

         proxy_pass   http://127.0.0.1:88;

         proxy_set_header Host   $host;

         proxy_set_header X-Real-IP      $remote_addr;

         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }


    }

}

lamp  discuz+wordpress+phpmyadmin

# /usr/local/nginx/sbin/nginx -t

# service nginx configtest     

檢查語法

lamp  discuz+wordpress+phpmyadmin

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

通化市| 金堂县| 丹阳市| 石棉县| 东阳市| 双峰县| 尤溪县| 措勤县| 锦屏县| 治县。| 临海市| 西城区| 堆龙德庆县| 清水河县| 会泽县| 道真| 于田县| 乳源| 布拖县| 揭西县| 长乐市| 双辽市| 壶关县| 石景山区| 屯昌县| 攀枝花市| 临夏县| 岳池县| 乌拉特后旗| 秀山| 合作市| 逊克县| 龙南县| 宁晋县| 项城市| 临清市| 灯塔市| 阜城县| 尤溪县| 文水县| 阳江市|