Web Server

web
1目录访问配置:
(1).编辑apache主配置文件
    319:去掉Indexes
    326:改None为All
(2).在/var/www/html的访问目录中
    vim.htaccess
    添加
    Options Indexes
----------------------------------
2个人网站
(1).编辑apache主配置文件
    355:UserDir disable root(禁止root用户里面的东西被apache发不出去)
    361:UserDir public_html
   
    369 #<Directory /home/*/public_html>
    370   AllowOverride FileInfo AuthConfig Limit
    371     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    372     <Limit GET POST OPTIONS>
    373         Order allow,deny
    374         Allow from all
    375     </Limit>
    376     <LimitExcept GET POST OPTIONS>
    377         Order deny,allow
    378         Deny from all
    379     </LimitExcept>
    380 </Directory>
(2).创建用户test
    chmod 711 /home/test/(这一步和重要!)
    cd/home/test
    mkdir public_html
    cd public_html
    vim index.html
    chown test.test index.html(这一步很重要!)
-------------------------
3.web的基本身份认证
(1) 在apache主配置文件编辑
    在文件末尾添加
   
    <Directory "/var/www/html/mytest">
       AllowOverride None
       AuthType Basic
       AuthName "myrealm"
       AuthUserFile /var/www/passwd/myrealm
       require valid-user
    </Directory>
(2)  cd/var/www
     mkdir passwd
     cd passwd
     htpasswd -c myrealm test1
     htpasswd myrealm test2
     chown apache myrealm (这一步很重要)
     chmod 700 myrealm
(3)  cd/var/www/thml
     mkdir mytest
     cd mytest
     vim index.html
     重启httpd就行了!
-------------------------
4.基于主机名的虚拟主机
(1).在dns的---.zone 配置文件中,添加虚拟主机的CNAME记录!
(2).编辑apache的主配置文件
    971:去掉#
    在文件末尾添加
    <VirtualHost *:80>
    DocumentRoot /var/www/html
    </VirtualHost>(这一段配置很重要)
    <VirtualHost *:80>
    ServerName www1.abc.com
    DocumentRoot /var/www/html/www1
    </VirtualHost>
    <VirtualHost *:80>
    ServerName www2.abc.com
    DocumentRoot /var/www/html/www2
    </VirtualHost>
(3).重启服务!
----------------------------
5.虚拟主机的身份认证
(1).在dns的---.zone 配置文件中,添加虚拟主机的CNAME记录!
(2).编辑apache的主配置文件
    <VirtualHost *:80>
    DocumentRoot /var/www/html
    </VirtualHost>(这一段配置很重要)
    <VirtualHost *:80>
       ServerName www1.abc.com
       DocumentRoot /var/www/html/www1
       <Directory /var/www/html/www1>
       AuthName TestAuth
       AuthType Basic
       AuthUserFile /etc/httpd/.webuser
       Require User lala
       </Directory>
    </VirtualHost>
    (3).cd /etc/httpd
    htpasswd -cm .webuser lala
    htpasswd -m .webuser haha
--------------------------------
6.LAMP+论坛
(1).rpm -ivh ncurses-devel-5.5-24.20060715.i386.rpm
(2).groupadd mysql
    useradd -g mysql mysql
(3).tar -zxvf mysql---------tar.gz
    cd mysql---
    ./configure --with-mysqld-user=mysql --prefix=/usr/local/mysql
    make (编译过程会很慢)
    make install
(4).cp support-files/my-medium.cnf /etc/my.cnf
(5).初始化数据库
    cd /usr/local
    /usr/local/mysql/bin/mysql_install_db --user=mysql
    chown -R mysql:mysql mysql/
(6).启动数据库
   /usr/local/mysql/bin/mysqld_safe --user=mysql &
(7).cd /mnt/mysql---
    cd support-files/
    cp mysql.server /etc/init.d/mysql
    chmod 755 /etc/init.d/mysql
    /etc/init.d/mysql stop
    /etc/init.d/mysql start
    ps -ef | grep mysql
    chkconfig --add mysql
    chkconfig --list mysql
(8).export PATH=$PATH:/usr/local/mysql/bin/mysql
    mysql -u root (如果这条命令不成功,就到/usr/local/mysql/bin里面执行)
    mysqladmin -u root password 123
    mysql -u root -p
---
(1).tar -z/jxvf httpd-------
    cd httpd-----
    ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
    make
    make install
(2)./usr/local/apache2/bin/apachectl start
    netstat -tln
----
(1).tar -zxvf php------ -C /usr/local/src
    cd /usr/local/src/php---
    ./configure --prefix=/usr/local/php \
    --with-apxs2=/usr/local/apache2/bin/apxs \
    --with-mysql=/usr/local/mysql \
    --with-config-file-path=/usr/local/php
    安装过程可以会出现问题,根据提示解决问题!
    make
    make install
(2).cp php.ini-dist /usr/local/php/php.ini
(3).编辑apache主配置文件!
    395:DirectoryIndex index.html index.html.var index.php
    添加一行到
    836、837后
    AddType application/x-httpd-php .php
(4).cd/usr/local/apache2/htdocs
    vim test.php
    <? phpinfo();?>
(5)/usr/local/apache2/bin/apachectl restart
   重启后测试!
---
(1).cd/usr/local/apache2/htdocs/
    mkdir bbs
(2).unzip Discuz_------
    chmod -R 777 .
(3)在浏览器中进入到/bbs/upload/install里面安装
-------------------------
7LAMP+论坛--rpm
(1).rpm -ivh httpd-2----
    rpm -ivh php-common----
    rpm -ivh php-cli-5----
    rpm -ivh php-5----
    rpm -ivh mysql-5----   
    rpm -ivh perl-DBI-----
    rpm -ivh perl-DBD-MySQL------
    rpm -ivh mysql-server-----
    rpm -ivh mysql-devel----
(2)./etc/init.d/mysqld restart
(3).cd /var/www/html
    vim test.php
    <? phpinfo()?>
    /etc/init.d/httpd restart
    测试php是否成功!
(4).rpm -ivh php-pdo-5---
    rpm -ivh php-mysql---
    rpm -ivh php-mbstring-----
(5).php -m
(6).vim /etc/php.ini
       extension=mysql.so
       extension=mysqli.so
       extension=pdo_mysql.so
       extension=mbstring.so
(7).cd /var/www/html
    mdkir bbs
    cd bbs
    unzip Discu------
    cd upload
    chmod -R 777 .
(8).到浏览器中进行安装!  

 

本文出自 “记录我的学习” 博客,转载请与作者联系!

你可能感兴趣的:(Web,server,lamp,论坛)