Ubuntu下安装Nginx

来源:互联网 发布:usleep 源码 编辑:程序博客网 时间:2024/04/29 00:43
./configure: error: the HTTP rewrite module requires the PCRE library.解决方法:apt-get install libpcre3-dev./configure: error: the HTTP gzip module requires the zlib library.解决方法:sudo apt-get install zlib1g-dev再次编译:robert@ubuntu-vm:~/nginx/nginx-1.0.14$ ./configure checking for OS + Linux 4.2.0-16-generic i686checking for C compiler ... found + using GNU C compiler + gcc version: 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) checking for gcc -pipe switch ... foundchecking for gcc builtin atomic operations ... foundchecking for C99 variadic macros ... foundchecking for gcc variadic macros ... foundchecking for unistd.h ... foundchecking for inttypes.h ... foundchecking for limits.h ... foundchecking for sys/filio.h ... not foundchecking for sys/param.h ... foundchecking for sys/mount.h ... foundchecking for sys/statvfs.h ... foundchecking for crypt.h ... foundchecking for Linux specific featureschecking for epoll ... foundchecking for sendfile() ... foundchecking for sendfile64() ... foundchecking for sys/prctl.h ... foundchecking for prctl(PR_SET_DUMPABLE) ... foundchecking for sched_setaffinity() ... foundchecking for crypt_r() ... foundchecking for sys/vfs.h ... foundchecking for nobody group ... not foundchecking for nogroup group ... foundchecking for poll() ... foundchecking for /dev/poll ... not foundchecking for kqueue ... not foundchecking for crypt() ... not foundchecking for crypt() in libcrypt ... foundchecking for F_READAHEAD ... not foundchecking for posix_fadvise() ... foundchecking for O_DIRECT ... foundchecking for F_NOCACHE ... not foundchecking for directio() ... not foundchecking for statfs() ... foundchecking for statvfs() ... foundchecking for dlopen() ... not foundchecking for dlopen() in libdl ... foundchecking for sched_yield() ... foundchecking for SO_SETFIB ... not foundchecking for SO_ACCEPTFILTER ... not foundchecking for TCP_DEFER_ACCEPT ... foundchecking for accept4() ... foundchecking for int size ... 4 byteschecking for long size ... 4 byteschecking for long long size ... 8 byteschecking for void * size ... 4 byteschecking for uint64_t ... foundchecking for sig_atomic_t ... foundchecking for sig_atomic_t size ... 4 byteschecking for socklen_t ... foundchecking for in_addr_t ... foundchecking for in_port_t ... foundchecking for rlim_t ... foundchecking for uintptr_t ... uintptr_t foundchecking for system endianess ... little endianesschecking for size_t size ... 4 byteschecking for off_t size ... 8 byteschecking for time_t size ... 4 byteschecking for setproctitle() ... not foundchecking for pread() ... foundchecking for pwrite() ... foundchecking for sys_nerr ... foundchecking for localtime_r() ... foundchecking for posix_memalign() ... foundchecking for memalign() ... foundchecking for mmap(MAP_ANON|MAP_SHARED) ... foundchecking for mmap("/dev/zero", MAP_SHARED) ... foundchecking for System V shared memory ... foundchecking for POSIX semaphores ... not foundchecking for POSIX semaphores in libpthread ... foundchecking for struct msghdr.msg_control ... foundchecking for ioctl(FIONBIO) ... foundchecking for struct tm.tm_gmtoff ... foundchecking for struct dirent.d_namlen ... not foundchecking for struct dirent.d_type ... foundchecking for sysconf(_SC_NPROCESSORS_ONLN) ... foundchecking for PCRE library ... foundchecking for system md library ... not foundchecking for system md5 library ... not foundchecking for OpenSSL md5 crypto library ... not foundchecking for sha1 in system md library ... not foundchecking for OpenSSL sha1 crypto library ... not foundchecking for zlib library ... foundcreating objs/MakefileConfiguration summary  + using system PCRE library  + OpenSSL library is not used  + using builtin md5 code  + sha1 library is not found  + using system zlib library  nginx path prefix: "/usr/local/nginx"  nginx binary file: "/usr/local/nginx/sbin/nginx"  nginx configuration prefix: "/usr/local/nginx/conf"  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"  nginx pid file: "/usr/local/nginx/logs/nginx.pid"  nginx error log file: "/usr/local/nginx/logs/error.log"  nginx http access log file: "/usr/local/nginx/logs/access.log"  nginx http client request body temporary files: "client_body_temp"  nginx http proxy temporary files: "proxy_temp"  nginx http fastcgi temporary files: "fastcgi_temp"  nginx http uwsgi temporary files: "uwsgi_temp"  nginx http scgi temporary files: "scgi_temp"robert@ubuntu-vm:~/nginx/nginx-1.0.14$ 启动时,发现端口80被占用:robert@ubuntu-vm:/usr/local/nginx/sbin$ sudo ./nginx nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)nginx: [emerg] still could not bind()robert@ubuntu-vm:/usr/local/nginx/sbin$ 查看一下端口情况:robert@ubuntu-vm:/usr/local/nginx/sbin$ netstat -ntpl(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.)Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program nametcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -               tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      -               tcp6       0      0 :::80                   :::*                    LISTEN      -               tcp6       0      0 :::22                   :::*                    LISTEN      -               tcp6       0      0 ::1:631                 :::*                    LISTEN      -               tcp6       0      0 ::1:25                  :::*                    LISTEN      -               tcp6       0      0 ::1:6010                :::*                    LISTEN      -               robert@ubuntu-vm:/usr/local/nginx/sbin$ 修改一下Nginx的默认端口:robert@ubuntu-vm:/usr/local/nginx$ vim conf/nginx.conf将listen 80更改为8080重新启动,ok!

0 0
原创粉丝点击