• MacOS系统Web服务器


    1.Apache

    MacOS系统一般预装了Apache,我的机器是安装在/etc/apache2/目录中。

    配置文件为:/etc/apache2/httpd.conf

    Listen 8088
    
    DocumentRoot "/Library/WebServer/Documents"
    
    <Directory "/Library/WebServer/Documents">
    
    </Directory>

    apache命令:

    #开启apache:  
    sudo apachectl start
     
    #重启apache:  
    sudo apachectl restart
     
    #关闭apache:  
    sudo apachectl stop

    2.Tomcat

    配置文件位置:/usr/local/apache-tomcat-8.0.46/conf/server.xml

    <Server port="8005" shutdown="SHUTDOWN">
        <Service name="Catalina">
            <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
        </Service>
    </Server>

    tomcat命令:

    cd /usr/local/apache-tomcat-8.0.46/bin
    #开启tomcat:
    sudo ./startup.sh
    
    #关闭tomcat:
    sudo ./shutdown.sh

    3.Nginx

    配置文件位置:/usr/local/etc/nginx/nginx.conf

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    
        #gzip  on;
        server {
            listen 8001;
            server_name  localhost;
            location / {
                #root   /usr/local/Cellar/nginx/1.17.2/dist;
                root   /Volumes/系统;
                try_files $uri $uri/ /index.html last;
                index  index.html index.htm;
                autoindex on; #开启目录浏览
                autoindex_format html; #以html风格将目录展示在浏览器中
                autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB
                autoindex_localtime on; #以服务器的文件时间作为显示的时间
                charset utf-8,gbk;
            }
        }
        include servers/*;
    }

    nginx命令:

    #开启nginx: 
    nginx
    
    #重启nginx: 
    nginx -s reload
    
    #关闭nginx: 
    nginx -s quit
  • 相关阅读:
    nyoj112-指数运算
    nyoj51-管闲事的小明
    nyoj29-求置转换问题
    nyoj24-素数 距离问题
    nyoj22-素数求和问题
    nyoj23-取石子(一)
    nyoj4-ASCII码排序
    nyoj169-素数
    并查集:CDOJ1593-老司机破阵 (假的并查集拆除)
    线段树: CDOJ1598-加帕里公园的friends(区间合并,单点更新)
  • 原文地址:https://www.cnblogs.com/asenyang/p/14156674.html
Copyright © 2020-2023  润新知