Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Mac OS X 10.9 build Nginx + MySQL + php-fpm environment     - Java filter (Programming)

- Upload the project to GitHub, synchronous remote repository Github (Linux)

- Linux crontab command format example (Linux)

- Linux file time Comments ctime mtime atime (Linux)

- The method to mount the CD under Linux (Linux)

- Linux ban single-user mode to enhance system security (Linux)

- Linux install Maven and SVN client (Linux)

- Linux initialization init system - UpStart (Linux)

- Simple and fast sorting (Programming)

- Using shell users or virtual users to login to pureftpd (Linux)

- Hadoop 2.6.0 stand-alone / pseudo-distributed installation (Server)

- Oracle Client Easy Connection error ORA-12154, TNS-03505 (Database)

- MySQL Server Time Synchronization Problem (Database)

- CentOS 6.5 makes the LAN http source (Linux)

- Tip: Use Cryptsetup U disk encryption (Linux)

- JavaScript Advanced Programming notes event capture and event bubbling (Programming)

- CentOS 6.6 running level (Linux)

- Increase ssh security service under Linux (Linux)

- Oracle database on the hit rate of query summary (Database)

- How to create a cloud encrypted file system in Linux systems (Linux)

 
         
  Mac OS X 10.9 build Nginx + MySQL + php-fpm environment
     
  Add Date : 2018-11-21      
         
         
         
  Mac OSX 10.9 build Nginx + MySQL + php-fpm environment
My computer configuration
 
System version: 10.9.1
 
Install homebrew
 
Under mac homebrew is very easy to use package manager will automatically install the relevant dependencies, you will rely on software installed from the tedious freed. Install homebrew is very simple, as long as the input terminal:
 
ruby -e "$ (curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
 
homebrew commonly used commands:
- brew update # update the latest information available installation package, it is recommended before each run at installation
- brew search pkg_name # search-related information packet
- brew install pkg_name # installation package
 
Install nginx
 
installation
 
brew search nginx
 brew install nginx
 
Configuration file (already exist /usr/local/etc/nginx/nginx.conf)
 
cd / usr / local / etc / nginx / vim nginx.conf
 
Now I put the success of the configuration files posted
 
user hugo staff (here with the file repair becomes the same user / Users / hugo / Documents / PHP file);
 
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 8080;
 
    server_name localhost;
 
    root / Users / hugo / Documents / PHP (This is the file path to my own definition, index.php is located);
 
    index index.html index.htm index.php;
 

 

 


    #charset koi8-r;
 

 

    #access_log logs / host.access.log main;
 

 

    location / {
 
        #root html;
 
        #root / Users / hugo / Documents / PHP;
 
        #index index.html index.htm index.php;
 
        # $ Uri /index.php?$query_string;
 

 

    }
 

 

    #location ~ .php $ {
 

 

      # Fastcgi_pass 127.0.0.1:9000;
 
        #fastcgi_index index.php;
 
        #fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
 
        #include fastcgi_params;
 

 

    #}
 
    #location ~ (/ .) {
 
    # Deny all;
 
    #}
 
    location ~. * . php $
 
    {
 
            include fastcgi.conf;
 
            fastcgi_pass 127.0.0.1:9000;
 
            fastcgi_index index.php;
 
            fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
 
            include fastcgi_params;
 

 

            expires off;
 
    }
 

 

    #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 / Users / hugo / Documents / PHP;
 
    }
 

 

    # 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;
 
#}
 
#}
 

 

}
Install php-fpm

Mac OSX 10.9 system comes with PHP, php-fpm, eliminating the need to install the php-fpm. We should simply change the next php-fpm configuration, otherwise run php-fpm error.

sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf vim /private/etc/php-fpm.conf

Modify php-fpm.conf file error_log entries that are commented out by default, where the need to annotate and modify error_log = /usr/local/var/log/php-fpm.log. If you do not modify this value, run the php-fpm when the output will be prompted to log file path does not exist errors.

Also, this is very important changes: the user and group profiles with user modifications are the same as nginx
user = hugo
group = staff

If you can not save the php-fpm.conf the modified file, edit it before entering the previous command in sudo, sudo vim is

Install mysql

installation

brew install mysql

Common Commands
mysql.server start # start mysql service
mysql.server stop # service mysql Close

Configuration

In the terminal run mysql_secure_installation script that will be a step by step prompts you to set a series of security-related parameters, including: Setting the root password, turn off anonymous access, does not allow root users to remotely access, remove the test database. Of course, before running the script remember to start mysql service.

Testing nginx Service

Create a test file in the root folder entry corresponding files before nginx configuration file default.conf set in index.php: