建设网站相关法律条文,用vs2010做网站应用程序脱机,用dede做的网站首页,营销类网站建设需要注意的问题动态页面与静态页面的差别#xff1a; #xff08;1#xff09;URL不同 静态⻚⾯链接⾥没有“?” 动态⻚⾯链接⾥包含“#xff1f;” #xff08;2#xff09;后缀不同 (开发语⾔不同) 静态⻚⾯⼀般以 .html .htm .xml 为后缀 动态⻚⾯⼀般以 .php .jsp .py等为后…动态页面与静态页面的差别 1URL不同 静态⻚⾯链接⾥没有“?” 动态⻚⾯链接⾥包含“” 2后缀不同 (开发语⾔不同) 静态⻚⾯⼀般以 .html .htm .xml 为后缀 动态⻚⾯⼀般以 .php .jsp .py等为后缀 3内容不同 静态⻚⾯的内容是固定的 动态⻚⾯的内容会因⽤户、浏览器、时间、地点等⽽发⽣变化。 静态资源根据开发者保存在项目资源目录中的路径访问静态的资源包括html 图片 js css 音乐 视频
http协议
http原理 HTTP是⼀个基于TCP/IP通信协议来传递数据的协议传输的数 据类型为HTML ⽂件图⽚⽂件查询结果等。 HTTP协议⼀般⽤于B/S架构。浏览器作为HTTP客户端通过URL 向HTTP服务端即web服务器发送所有请求web服务器收到客 户端请求后进⾏响应。 http状态码 2xx成功200成功、201已经创建 3xx重定向304未修改 4xx请求错误404未找到⽂件、408请求超时 5xx服务器错500服务器内部错误、502⽹关错误 [rootgit ]# yum -y install httpd [rootgit html]# echo 我是静态的html文件 index.html
[rootgit html]# dd if/dev/zero of/var/www/html/a.txt bs30M count1 apache 最早的 web 服务程序基于 http 协议提供⽹⻚浏览服务 模块化设置、开放源代码、跨平台应⽤、⽀持多种 web 编程语 ⾔、运⾏稳定。 搭建apache服务器 查看华为云主机的所有的打开的端口
firewall-cmd --list-ports
停用防火墙或打开指定端口
firewall-cmd --zonepublic --add-port80/tcp --permanent
firewall-cmd --reload 启动端口
firewall-cmd --zonepublic --add-servicehttp --permanent 防⽕墙开放 http服务 下载http,并执行以下操作
touch /var/www/html/index.html
mkdir /var/www/html/img/
cp 300.3.png /var/www/html/img
vim /var/www/html/index.html 浏览器测试 nginx
源码编译安装nginx
注意html目录中的文件发生修改之后不需要重启nginx服务
1.下载源码包
在nginx.org中复制nginx-1.26.1.tar.gz包的地址在虚拟机中下载 wget https://nginx.org/download/nginx-1.26.1.tar.gz
2.解压
tar -zxvf nginx-1.26.1.tar.gz
3.下载nginx所需要的依赖包 gcc gcc-c openssl-devel pcre-devel
yum -y install gcc gcc-c openssl-devel pcre-devel
4.编译安装nginx ./configure --prefix/usr/local/nginx/ --usernginx --groupnginx --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-stream
make make install
5.nginx的启动
1)nginx的启动与关闭 2)创建脚本来启动nginx服务
[rootslave nginx]# vim ~/nginx.sh
3)守护进程以systemctl控制nginx
如果直接使用sbin目录下的nginx,就无法使用systemctl 在 /usr/lib/systemd/system ⽬录下新建⼀个 nginx.service ⾮⼿ 动执⾏脚本并使⽤ vim 命令添加以下内容 170 vim /usr/lib/systemd/system/nginx.service
[Unit] Descriptionnginx Afternetwork.target
[Service] Typeforking PIDFile/usr/local/nginx/logs/nginx.pid ExecStart/usr/local/nginx/sbin/nginx ExecReload/usr/local/nginx/sbin/nginx -s reload ExecStop/usr/local/nginx/sbin/nginx -s stop PrivateTmpFlase
[Install] WantedBymulti-user.target 171 systemctl daemon-reload 172 systemctl stop nginx 173 systemctl restart nginx 174 reboot 175 systemctl start nginx.service
4)创建软连接直接使用nginx命令 将软件⽬录下的 /usr/local/nginx/sbin/nginx 可执⾏程序软链接到/usr/sbin如果按照 Windows ⽅式来说相当于制作了⼀个 nginx 的快捷⽅式 之所以指令能在命令行使用是因为在$PATH目录中能找到这个可执行文件或者是可执行文件的链接文件
[rootslave nginx]# nginx -bash: nginx: 未找到命令 [rootslave nginx]# $PATH -bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin: 没有那个文件或目录
[rootslave nginx]# ln -s /usr/local/nginx/sbin/nginx /usr/bin/ [rootslave nginx]# ls -l /usr/bin/nginx lrwxrwxrwx. 1 root root 27 7月 29 16:15 /usr/bin/nginx - /usr/local/nginx/sbin/nginx [rootslave nginx]# nginx -s stop [rootslave nginx]# netstat -lnput | grep nginx [rootslave nginx]# nginx [rootslave nginx]# netstat -lnput | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8232/nginx: master
添加监控块:
修改配置文件,找到“server { }”添加⼀个“location { }”也就是虚拟主机
[rootslave ~]# vim /usr/local/nginx/conf/nginx.conf [rootslave ~]# systemctl reload nginx.service 配置多个虚拟主机 ⼀个“location”相当于⼀个虚拟主机也就是⽤户访问⽹站时 点击跳转的另⼀个⻚⾯。 location 内可以添加 nginx 各种功能模块 location / { root html; index index.html index.htm; } nginx反向代理配置
建立后端服务器 206 scp root192.168.118.54:~/nginx-1.26.1.tar.gz ./ 207 tar -zxvf nginx-1.26.1.tar.gz 209 cd nginx-1.26.1/ 210 yum -y install gcc gcc-c openssl-devel pcre-devel 219 ./configure --prefix/usr/local/nginx/ --usernginx --groupnginx --with-http_ssl_module -- with-http_stub_status_module --with-http_realip_module --with-stream 220 make 221 make install 222 useradd -s /bin/nologin -M nginx 223 echo 我是后端服务器 /usr/local/nginx/html/index.html 227 firewall-cmd --zonepublic --add-port80/tcp --permanent 228 /usr/local/nginx/sbin/nginx 234 firewall-cmd --reload