一、配置目标 1、通过lnmp完成基础环境的安装 通过lnmp安装后,相关软件的位置请参考其官方说明。安装后我单独通过气官方说明,升级了nginx的版本 2、配置nginx使之能满足phpjava环境在一台机器上的复用 二、相关安装说明 1、将tomcat安装到/usr/local/tomca
一、配置目标
1、通过lnmp完成基础环境的安装
通过lnmp安装后,相关软件的位置请参考其官方说明。安装后我单独通过气官方说明,升级了nginx的版本
2、配置nginx使之能满足php+java环境在一台机器上的复用
二、相关安装说明
1、将tomcat安装到/usr/local/tomcat6
2、将nginx安装到/usr/local/nginx
3、将java项目安装到tomcat6/webapps下
4、将php相关项目直接安装到/usr/local/下
三、相关配置说明
主要说明几个主配置文件的情况
1、nginx.conf
user www www; worker_processes 1; error_log /home/wwwlogs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; } #fastcgi参数的配置很重要。对性能影响较大 http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 256k; fastcgi_buffers 8 256k; fastcgi_busy_buffers_size 512k; fastcgi_temp_file_write_size 512k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #limit_zone crawler $binary_remote_addr 10m; #log format log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; #核心指出了各个域名的配置文件位置,在nginx/conf/vhost目录中 include vhost/*.conf; }
2、vhost(在nginx.conf指明了相关域名对应的配置文件位置)
(1)、php项目配置:文件名称shequ.jiuchongju.com.conf
这里我将一个域名的相关配置在这里展示:shequ.jiuchongju.com
server { listen 80; server_name shequ.jiuchongju.com; index index.html index.htm index.php; root /usr/local/discuzx/upload; location ~ .*\.(php|php5)?$ { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } location /status { stub_status on; access_log off; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/access.log access; }
(2)、java项目配置:文件名称www.quickbook.cn.conf
这里我指定了一个java项目的配置 www.quickbook.cn
server { listen 80; server_name www.quickbook.cn; #charset koi8-r; access_log logs/dev/null; root /usr/local/tomcat6/webapps/quickbook/; #将请求反向代理到tomcat应用服务器上了 location / { index index.jsp index.html index.htm ; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_buffers 32 4k; proxy_connect_timeout 3; proxy_send_timeout 30; proxy_read_timeout 30; proxy_pass http://127.0.0.1:8080; } }
三、总结
1、主要是nginx将各个子域名的配置放到conf/vhost中独立处理
2、每个vhost下的配置文件都独立生效
3、nginx只是将请求转发到后端的应用服务器上
4、启动的时候需要按照如下次序启动
(1)、启动mysql数据库
(2)、启动tomcat
(3)、启动nginx

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

SublimeText3 영어 버전
권장 사항: Win 버전, 코드 프롬프트 지원!
