linux建立网站服务器(linux网站部署)

admin 63 2022-12-06

本文目录一览:

如何在linux搭建完整的web服务器?

可以参考如下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

怎么在linux服务器上建立网站

1.

已绑定域名,则直接使用网站域名访问即可;

2.

若未绑定域名,可使用linux服务器ip+80端口访问;

3.

当然,web服务器的默认端口是80,也有可能是其他端口,这就需要根据实际情况来确定了。

阿里云服务器Linux主机如何搭建网站环境

我们一般不提倡用命令行来搭建网站环境,入手太难,还总出错。

按照linux 系统来说,可以去左侧点击实例,在服务器列表右侧有一个服务器列表,列表中的最右侧 点击 更多,可以看到更换系统盘的选项,点击进入后,能看到公共镜像,包括linux 和windows,还有可选的 宝塔面板,建站的话使用这个就可以了。

如果你选择的是 windows系统,那么也可以安装相应的环境面板来建站,可以去博客里面找找看。

更多内容请参阅阿里云帮助文档吧,内容挺丰富的,这里也写不开。看不懂可以问我。

Linux怎么搭建Web服务器

 Linux怎么搭建Web服务器

1,基于apache的web服务器基础搭建:

(1)实验环境:一台ip为192.168.10.10的rhel5.9主机作为web服务器,一台ip为192.168.10.15的win7主机作为测试机

(2)查看服务主机软件是否安装

[root@ser1 ~]# rpm -q httpd httpd-manual httpd-devel

package httpd is not installed

package httpd-manual is not installed

package httpd-devel is not installed

(3)安装软件包

[root@ser1 ~]# yum install -y httpd httpd-manual httpd-devel

(4)启动服务

[root@ser1 ~]# service httpd start

启动httpd: [确定]

[root@ser1 ~]# chkconfig httpd on

(5)在win7上测试,无网页缺省下显示红帽测试页

报错页面存放位置/var/www/error/noindex.html

wKioL1Mb2uORI8EtAASazHYmqP8425.jpg

(6)打开配置文件

[root@ser1 ~]# vim /etc/httpd/conf/httpd.conf

可获得以下重要字段:

目录设置:

Directory 目录 .. .. /Directory

访问位置设置:

LocationURL .. .. /Location

虚拟主机设置:

VirtualHost 监听地址 .. .. /VirtualHost

常用的全局设置参数:

ServerName本站点的FQDN名称

DocumentRoot网页文档的根目录:缺省/var/www/html/

DirectoryIndex默认索引页/首页文件:一般设为index.html index.php

ErrorLog错误日志文件的位置

CustomLog 访问日志文件的位置

Listen 监听服务的IP地址、端口号

ServerRoot 服务目录:/etc/httpd/

Timeout网络连接超时,默认 300 秒

KeepAlive是否保持连接,可选On或Off

MaxKeepAliveRequests每次连接最多处理的请求数

KeepAliveTimeout保持连接的超时时限

Include 可包含其他子配置文件: /etc/httpd/conf.d/

(7)创建测试网页

[root@ser1 ~]# vim /var/www/html/index.html

h1

This is a test page !!!

/h1

~

(8)win7下测试,主页变为测试网页

wKioL1Mb2xKDIxJ8AADmMPwbQrU088.jpg

2,基于apache的web服务器的访问控制:

(1)web服务的地址限制

I,rder 配置项,定义控制顺序

allow,deny 先允许后拒绝,缺省拒绝所有;冲突时,拒绝生效;allow不设置,拒绝所有

deny,allow 先拒绝后允许,缺省允许所有;冲突时,允许生效;deny不设置,允许所有

II,Allow/Deny from 配置项,设置权限

Allow from 地址1 地址2 .. ..

Deny from 地址1 地址2 .. ..

配置如下:

[root@ser1 ~]# vim /etc/httpd/conf/httpd.conf

331 #

332 Orderallow,deny

333 Allowfrom 192.168.20.0/24

334

335 /Directory

[root@ser1 ~]# service httpd restart……重启服务

停止httpd: [确定]

启动httpd: [确定]

在win7上测试,测试完成并还原配置文件:

wKiom1Mb22Pi1WcbAAIdasyq1FQ074.jpg

看过“ Linux怎么搭建Web服务器 ”的人还看了:

1.win7如何搭建Web服务器

2.基于WebRTC的浏览器端Web服务器的研究论文

3.LINUX下配置管理APACHE服务器的方法

4.如何安全设置Apache Web服务器

5.全国网络技术水平考试二级实践指导书

linux建立网站服务器的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于linux网站部署、linux建立网站服务器的信息别忘了在易优之家进行查找喔。

上一篇:风云网ppt模板官网(风云办公ppt会员登录)
下一篇:注册网页模板(注册网页模板怎么弄)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~