当前位置:Gxlcms > PHP教程 > linux配置webserver简易步骤

linux配置webserver简易步骤

时间:2021-07-01 10:21:17 帮助过:2人阅读

1.安装nginx

aptitude install nginx

2.配置nginx

1.查看nginx状态,启动,重载等命令
    service nginx status
    service nginx start
    service nginx reload
2.添加虚拟主机
在/etc/nginx/conf.d中建立相关的文件夹,将配置文件放到该文件夹下。
配置文件例:vhosts_sample.conf
    server {
        listen8080;  #端口
        root /usr/share/nginx/wlj;   #网页文件存放路径indexindex.html index.htm;

        # Make site accessible from http://localhost/
        server_name wljcloud.com;  #域名        location / {
                # First attempt to serve request as file, then# as directory, then fall back to displaying a 404.
                try_files $uri$uri/ =404;
                # Uncomment to enable naxsi on this location# include /etc/nginx/naxsi.rules
        }
}
3.修改nginx.conf文件,在http段下添加刚才的路径,例
include /etc/nginx/conf.d/vhosts_conf/*.conf;
4.将网页文件放到刚配置的路径中
cp -r 文件源路径 /usr/share/nginx/wlj
5.重新加载nginx的配置文件
    service nginx reload

3.访问站点

例:101.201.196.130:8080/index.html

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了linux配置webserver简易步骤,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 人气教程排行