如何构建web服务器

如何构建web服务器,第1张

可以参考如下Web服务器的建立过程。示例环境及web服务器软件:

Ubuntu 12.04

LAMP(Linux,Apache,Mysql,PHP)

1、安装Apache

(1)在安装HTTP Server之前需安装APR(Apache Portable Runtime)和APR-util安装APR

$ tar zxvf apr-1.4.6.tar.gz

$ cd apr-1.4.6/

$ ./configure

$ make

$ sudo make install

(2)安装APR-util

$ tar zxvf apr-util-1.4.1.tar.gz

$ cd apr-util-1.4.1

$ ./configure –with-apr=/usr/local/apr (whereis apr)

$ make

$ sudo make install

(3)安装httpd-2.4.2.tar.bz2默认安装位置/usr/local/apache2网页放在/usr/local/apache2/htdocs配置文件/usr/local/apache2/conf/httpd.conf

$ tar jxvf httpd-2.4.2.tar.bz2

$ cd httpd-2.4.2/

$ ./configure

$ make

$ sudo make install

(4)启动HTTP Server$ sudo /usr/local/apache2/bin/apachectl startAH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

(5)查看http是否正常运行$ netstat -a | grep httptcp 0 0 *:http *:* LISTEN

(6)在浏览器输入127.0.0.1如果正常应该显示“It works!”

2、安装MySQL

(1)、下载安装mysql-5.5.25.tar.gz,默认安装位置/usr/local/mysql/

$ tar zxvf mysql-5.5.25.tar.gz

$ cd mysql-5.5.25/

$ sudo groupadd mysql

$ sudo useradd -r -g mysql mysql

$ cmake .

$ make

$ sudo make install

$ cd /usr/local/mysql/

$ sudo chown -R mysql .

$ sudo chgrp -R mysql .

$ sudo scripts/mysql_install_db –user=mysql

$ sudo chown -R root .

$ sudo chown -R mysql data/

$ sudo cp support-files/my-medium.cnf /etc/my.cnf

$ sudo cp support-files/mysql.server /etc/init.d/mysql.server

(2)、启动MySQL:

方法1:$ sudo service mysql.server start

方法2:$ sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

3、安装PHP

(1)安装下载php-5.4.4.tar.gz

$ tar zxvf php-5.4.4.tar.gz

$ cd php-5.4.4

$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --enable-mbstring --with-mcrypt(可能需要安装libmcrypt-dev )

$ sudo make install

$ sudo cp php.ini-development /usr/local/lib/php.ini

(2)配置HTTP Server使之支持PHPapache配置文件/usr/local/apache2/conf/httpd.conf修改或添加如下配置

<IfModule dir_module>

DirectoryIndex index.php

</IfModule>

<FilesMatch \.php$>

SetHandler application/x-httpd-php

</FilesMatch>

(3)重启HTTP Server

$ sudo /usr/local/apache2/bin/apachectl restart

1、点击“Windows”键进入“开始”菜单,点击“所有应用”,在所有应用菜单里点击“Windows系统”里的“控制面板”

2、在控制面板对话框里点击“程序

3、在程序面板里面点击“启用或关闭windows功能

4、在“Windows功能”对话框里选中“Internet Information Services”,在Internet Information Services功能展开选择框里根据你的需要选择你需要的功能就行了,比如我不知道需要哪些功能所以全部选中反正不会出错就好了,只要选中这些功能就行了。并点击“确定”按钮。

5、Windows功能开始下载并安装你要的功能的程序,直到出现“Windows已完成请求的更改”,点击重启电脑

6、打开浏览器输入localhost能打开,就说明安装成功。

7、接下来我们要打开IIS管理器。桌面上右键点击此电脑,管理。即可进入计算机管理在服务和应用程序里有IIS管理器,点击 进入IIS管理器。

8、我们可以看到中间部分有很多图标,找到ASP,点击。

9、这一步是配置asp应用程序,找到启用父路径,选为True。

10、到这里IIS环境已经搭建好了,在浏览器里输入localhost就可以看到iis的主页了。想要添加网站程序可以点右侧的高级设置,将物理路径改成你的网站程序就能访问了。


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/279835.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-21
下一篇2023-04-21

发表评论

登录后才能评论

评论列表(0条)

    保存