搭建网站
本人这几天学习搭建了一个小说的网站,中途遇到了不少的问题,跟大家分享一下解决的方法。
- 搭建网站的工具下载
- 搭建网站工具中显示hosts丢失,或者无法同步
- 伪静态内容
- 网页权限设置
搭建网站工具下载
建议使用phpstudy小皮,这里先将phpstudy官网网址贴出来方便下载,https://www.xp.cn,phpstudy是一个PHP调试环境的程序集成包。该程序包集成最新的Apache+PHP+MySQL+phpMyAdmin+ZendOptimizer,一次性安装,无须配置即可使用,是非常方便、好用的PHP调试环境,该程序不仅包括PHP调试环境,还包括了开发工具、开发手册等,比较容易使用。
搭建网站中显示hosts丢失
在这里先给出一个hosts文件内容
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 www.test.com
127.0.0.1 188asdasg
在小皮左侧设置里有一个hosts文件,将这个
内容拷进去保存即可。
伪静态设置
一些网站中需要设置伪静态,伪静态同样是一串代码,代码贴出来 。
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
这个就是伪静态的内容,至于每个句子的含义,我就不一一解释了,感兴趣的可以上网去搜一下。
网站权限设置
找到文件中www下的网站文件,右击找到属性,切换到安全一栏,加入Everyone,单机确定,在权限列表中选择【读取和运行】、【列出文件夹目录】【读取】权限后,单击【确定】按钮,即可完成设置。
网站源代码的分享我就不贴出来了,有兴趣的可以找我要,本人的是一个小说网站的源代码。