The author for this configuration of the installation of things most head, local apache for the proxy service this or not quite understand, forced to live, yao way, or have to learn to install this thing.
1. Install the brew
Nginx must be installed using the brew name.
This is mainly for the configuration of Nginx, for the installation of BREW or refer to the link below, I installed the version of the University of Science and Technology of China.
www.jianshu.com/p/dff8c837b…
2. Install nginx:
brew install nginx
: Direct installation can be, there is nosudo
, that is, no administrator privileges are required
nginx -v
: The installation is successful if the version number is displayed.
3. Start nginx and configure related files
cd /usr/local/etc/nginx
: Go to the installation path foldervim nginx.conf
: Opens the configuration file
Here is my configuration file:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 9200; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } location /expertReview { alias "/Users/xuyongqi/jobs/expertReview"; index index.html index.htm; Error_page 405 =200 http://$host:$server_port$request_uri; } the location/idtAppServiceV6 {# proxy_pass http://39.105.123.5:9090/idtAppServiceV6; # proxy_pass http://199.66.68.4:8001/idtAppServiceV6; # proxy_pass http://199.66.68.30:6099/idtAppServiceV6; Proxy_pass http://199.66.68.83:18080/idtAppServiceV6; # proxy_pass http://199.66.68.61:18084/idtAppServiceV6; # proxy_set_header Cookie 'theworld_client_none=yyyyz'; # proxy_set_header Host $host; } the location/platformv6 {# proxy_pass http://199.66.68.83:18080/platformv6; # proxy_set_header Cookie 'theworld_client_none=yyyyz'; # proxy_set_header Host $host; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~.php${# proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~.php${# root HTML; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:! aNULL:! MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} include servers/*; }Copy the code
4. Customizing common commands on MAC:
-
Vim ~/. Bash_profile: Sets environment variables, paths, and custom global commands
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm export ANDROID_HOME=/Users/xuyongqi/Library/Android/sdk export PATH=${PATH}:${ANDROID_HOME}/platform-tools export PATH = ${PATH} : ${ANDROID_HOME} / tools export PATH = ${PATH} : ${ANDROID_HOME} / build tools / 28.0.3 export PATH=${PATH}:/usr/local/mysql/bin export PATH=${PATH}:/usr/local/mongodb/bin export PATH=${PATH}:~/Library/Android/sdk/platform-tools alias start-sql="sudo /usr/local/mysql/support-files/mysql.server start" alias stop-sql="sudo /usr/local/mysql/support-files/mysql.server stop" alias start-nginx="brew services start nginx" alias stop-nginx="brew services stop nginx"Copy the code
- I set it up here
start-sql
,stop-sql
And so on is on and offmysql
Custom command, will bring a lot of convenience
- I set it up here
-
Source. bash_profile: Makes the above configuration file changes take effect immediately.