1:安装c++编译环境,如已安装可略过;
yum -y install gcc-c++ yum -y install pcre pcre-devel yum -y install zlib zlib-devel yum -y install openssl openssl-devel yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced
./configure
3: 安装:
make && make install
4:启动:
whereis nginx ;
cd usr/local/nginx/sbin/
./nginx
5:浏览:
localhost
7配置:静态网页
server {
listen 80; # 监听本机所有 ip 上的 80 端口
server_name _; # 域名:www.example.com 这里 "_" 代表获取匹配所有
root /html/; # 站点根目录
index index.html;
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}