<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 安裝Nginx ``` brew install nginx --with-http_geoip_module ``` Nginx啟動關閉命令: ``` #測試配置是否有語法錯誤 nginx -t #打開 nginx sudo nginx #重新加載配置|重啟|停止|退出 nginx nginx -s reload|reopen|stop|quit #停止nginx sudo pkill -9 nginx #也可以使用Mac的launchctl來啟動|停止 launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist ``` Nginx開機啟動 ``` ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist ``` Nginx監聽80端口需要root權限執行,因此:(可選) ``` sudo chown root:wheel /usr/local/Cellar/nginx/1.6.0_1/bin/nginx sudo chmod u+s /usr/local/Cellar/nginx/1.6.0_1/bin/nginx ``` ## 配置nginx.conf 創建需要用到的目錄: ``` mkdir -p /usr/local/var/logs/nginx //mkdir -p /usr/local/etc/nginx/sites-available //mkdir -p /usr/local/etc/nginx/sites-enabled //mkdir -p /usr/local/etc/nginx/conf.d mkdir -p /usr/local/etc/nginx/ssl sudo mkdir -p /var/www sudo chown :staff /var/www sudo chmod 775 /var/www ``` `vim /usr/local/etc/nginx/nginx.conf `輸入以下內容: ``` worker_processes 1; error_log /usr/local/var/logs/nginx/error.log debug; pid /usr/local/var/run/nginx.pid; events { worker_connections 256; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /usr/local/var/logs/access.log main; sendfile on; keepalive_timeout 65; port_in_redirect off; include /usr/local/etc/nginx/servers/*; } ``` 設置nginx php-fpm配置文件 ``` vim /usr/local/etc/nginx/conf.d/php-fpm #proxy the php scripts to php-fpm location ~ \.php$ { try_files $uri = 404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_intercept_errors on; include /usr/local/etc/nginx/fastcgi.conf; } ``` nginx虛擬主機準備工作 ``` #創建 info.php index.html 404.html 403.html文件到 /var/www 下面 vi /var/www/info.php vi /var/www/index.html vi /var/www/403.html vi /var/www/404.html ``` 創建默認虛擬主機default `vim /usr/local/etc/nginx/sites-available/default`輸入: ``` server { listen 80; server_name localhost; root /var/www/; access_log /usr/local/var/logs/nginx/default.access.log main; location / { index index.html index.htm index.php; autoindex on; include /usr/local/etc/nginx/conf.d/php-fpm; } location = /info { allow 127.0.0.1; deny all; rewrite (.*) /.info.php; } error_page 404 /404.html; error_page 403 /403.html; } ``` 創建ssl默認虛擬主機default-ssl `vim /usr/local/etc/nginx/sites-available/default-ssl`輸入: ``` server { listen 443; server_name localhost; root /var/www/; access_log /usr/local/var/logs/nginx/default-ssl.access.log main; ssl on; ssl_certificate ssl/localhost.crt; ssl_certificate_key ssl/localhost.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { include /usr/local/etc/nginx/conf.d/php-fpm; } location = /info { allow 127.0.0.1; deny all; rewrite (.*) /.info.php; } error_page 404 /404.html; error_page 403 /403.html; } ``` 創建phpmyadmin虛擬主機 `vim /usr/local/etc/nginx/sites-available/phpmyadmin` #輸入以下配置 ``` server { listen 306; server_name localhost; root /usr/local/share/phpmyadmin; error_log /usr/local/var/logs/nginx/phpmyadmin.error.log; access_log /usr/local/var/logs/nginx/phpmyadmin.access.log main; ssl on; ssl_certificate ssl/phpmyadmin.crt; ssl_certificate_key ssl/phpmyadmin.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { index index.html index.htm index.php; include /usr/local/etc/nginx/conf.d/php-fpm; } } ``` 設置SSL ``` mkdir -p /usr/local/etc/nginx/ssl openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=State/L=Town/O=Office/CN=localhost" -keyout /usr/local/etc/nginx/ssl/localhost.key -out /usr/local/etc/nginx/ssl/localhost.crt openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=State/L=Town/O=Office/CN=phpmyadmin" -keyout /usr/local/etc/nginx/ssl/phpmyadmin.key -out /usr/local/etc/nginx/ssl/phpmyadmin.crt ``` 創建虛擬主機軟連接,開啟虛擬主機 ``` ln -sfv /usr/local/etc/nginx/sites-available/default /usr/local/etc/nginx/sites-enabled/default ln -sfv /usr/local/etc/nginx/sites-available/default-ssl /usr/local/etc/nginx/sites-enabled/default-ssl ln -sfv /usr/local/etc/nginx/sites-available/phpmyadmin /usr/local/etc/nginx/sites-enabled/phpmyadmin ``` 啟動|停止Nginx ``` launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist ``` 接下來你可以通過下面這些連接訪問: ``` http://localhost/ -> index.html http://localhost/info -> info.php via phpinfo(); http://localhost/404 -> 404.html https://localhost/ -> index.html(SSL) https://localhost/info -> info.php via phpinfo();(SSL) https://localhost/404 -> 404.html(SSL) https://localhost:306 -> phpmyadmin(SSL) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看